API Reference for Enthought Tool Suite 3.2.0
Simple utility code for animations.
A convenient decorator to animate a generator that performs an animation. The delay parameter specifies the delay (in milliseconds) between calls to the decorated function. If ui is True, then a simple UI for the animator is also popped up. The decorated function will return the Animator instance used and a user may call its Stop method to stop the animation.
If an ordinary function is decorated a TypeError will be raised.
Parameters
delay: int specifying the time interval in milliseconds between calls to the function. ui: bool specifying if a UI controlling the animation is to be provided.
Returns
The decorated function returns an Animator instance.
Examples
Here is the example provided in the Animator class documentation:
>>> from enthought.mayavi import mlab >>> @mlab.animate ... def anim(): ... f = mlab.gcf() ... while 1: ... f.scene.camera.azimuth(10) ... f.scene.render() ... yield ... >>> a = anim() # Starts the animation.
For more specialized use you can pass arguments to the decorator:
>>> from enthought.mayavi import mlab >>> @mlab.animate(delay=500, ui=False) ... def anim(): ... f = mlab.gcf() ... while 1: ... f.scene.camera.azimuth(10) ... f.scene.render() ... yield ... >>> a = anim() # Starts the animation without a UI.
| Local name | Refers to |
|---|---|
| Button | enthought.traits.trait_types.Button |
| Group | enthought.traits.ui.group.Group |
| HasTraits | enthought.traits.has_traits.HasTraits |
| Instance | enthought.traits.trait_types.Instance |
| Item | enthought.traits.ui.item.Item |
| Range | enthought.traits.trait_types.Range |
| Timer | enthought.pyface.timer.timer.Timer |
| types | types |
| View | enthought.traits.ui.view.View |
© Copyright 2002-2009 Enthought, Inc.