GUI neutral animation example doesn't work with WxAgg/Wx

The GUI neutral animation example from the SciPy cookbook doesn't seem to work for Wx or WxAgg backends. A plot window opens but nothing happens. It appears to be some weird problem with ion on wx.

For example, the following code will run and immediately close:
>>> plt.ion()
>>> plt.plot(x, y)
>>> plt.show()
After removing plt.ion(), a plot window is opened and the program doesn't end until the window is closed (as expected).

If I use TkAgg or Qt4Agg (the only other GUI backends I have installed) the examples (above and below) work as expected.

-Tony

Full Example:

···

#~~~~
import matplotlib
matplotlib.use('WxAgg')
import matplotlib.pyplot as plt
import numpy as np

plt.ion()
x = np.arange(0, 2*np.pi, 0.01)
line, = plt.plot(x, np.sin(x))
for i in np.arange(1, 20):
     line.set_ydata(np.sin(x + i/10.0))
     plt.draw()
#~~~~

PS. This seems to work the same on both trunk and 0.98.3.

GUI neutral animation is not supported or recommended. I need to
update the cookbook, but if you want to do it that would be great as I
am short on time until next week. The examples in examples/animation
are the recommended way:

  http://matplotlib.sourceforge.net/examples/user_interfaces/index.html

I have spent some time working on abstracting the necessary parts, eg
the idle handler, but have not completed this across interfaces.

JDH

···

On Thu, Oct 23, 2008 at 10:30 AM, Tony S Yu <tonyyu@...1166...> wrote:

The GUI neutral animation example from the SciPy cookbook doesn't seem
to work for Wx or WxAgg backends. A plot window opens but nothing
happens. It appears to be some weird problem with ion on wx.

I'd be happy to help, but I'm not sure what had you in mind. Sorry I'm still a student---I need guidance. :wink:

-Tony

···

On Oct 23, 2008, at 12:00 PM, John Hunter wrote:

On Thu, Oct 23, 2008 at 10:30 AM, Tony S Yu <tonyyu@...1166...> wrote:

The GUI neutral animation example from the SciPy cookbook doesn't seem
to work for Wx or WxAgg backends. A plot window opens but nothing
happens. It appears to be some weird problem with ion on wx.

GUI neutral animation is not supported or recommended. I need to
update the cookbook, but if you want to do it that would be great as I
am short on time until next week.