matplotlib/matplotlib — pull request #1907 by mdehoon (2013-04-15 22:00:27+00:00)
Title: Timers independent of canvases

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 am therefore proposing to make timers independent of canvases. With this pull request, the above code would become
>>> 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 verified that the animation examples still work correctly with all backends.