Dear all,

The animation code in matplotlib relies on timers to update the animated 
figures. Currently a new timer is created by calling new_timer on a canvas, as 
in

>>> f = pylab.figure()
>>> timer = f.canvas.new_timer()

This seems a bit of a wrinkle. For example, you may want to associate a timer 
with multiple figures, or with no figure at all; also you may want to continue 
using a timer after a particular figure is closed.

I would therefore propose to make timers independent of canvases. Something 
like this:

>>> from matplotlib import events
>>> timer = events.Timer()

This has the additional advantage of making the different backends more similar 
to each other; in the current implementation some backends rely on the canvas 
when making a timer, while others ignore it.

I have made a branch on github that does exactly this; see
https://github.com/mdehoon/matplotlib/tree/Timer
I have verified that the animation examples still work correctly with all 
backends.

Any comments/suggestions/criticisms? If this seems a good idea, I can make a 
pull request.

Best,
-Michiel.

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to