From: Todd M. <jm...@st...> - 2005-01-26 15:30:36
|
On Wed, 2005-01-26 at 10:09, John Hunter wrote: > >>>>> "Hans" == Hans Fangohr <H.F...@so...> writes: > > Hans> I didn't make myself very clear, or I have misunderstood the > Hans> meaning of "interactive". I presumed that 'interactive' > Hans> means: I issue the plot command and the figure pops up > Hans> immediatly, etc. > > Hans> Not interactive (in my understanding) means that I issue all > Hans> the matplotlib commands I'd like to use and at the end I can > Hans> use show() to display the picture. > > This partially but not completely correct, but it is admittedly > confusing. Make sure you have read > http://matplotlib.sourceforge.net/interactive.html and > http://matplotlib.sourceforge.net/faq.html#SHOW . As emphasized in > the FAQ > > IMPORTANT: show should called at most once per script and it should > be the last line of your script. At that point, the GUI takes > control of the interpreter. If you want to force a figure draw, use > draw instead. > > If you are issuing plot commands from idle, you need interactive : > True, you should not use show, and if you want finer control of when > the plot pops up and it drawn, use the commands ion, ioff and draw, as > explained on the interactive.html link. > > Hope this helps -- if you still encounter problems please let us know > because it is always possible there is a bug .... I'm really busy this morning (like what else is new for any of us), but I can confirm that there is a bug in 0.71. The root cause is that an "extra" mainloop is now run by matplotlib in "Idle -n" which already has a mainloop of its own. I think the key to solving this class of problem is to detect the presence of "freebe" mainloops to avoid running two mainloops while ensuring that we run at least one. To do this, I'm hoping matplotlib can ask Tkinter if a mainloop is running or not. The only alternative that occurs to me is to detect the presence of particular shells and maintain knowledge about the "freebe mainloop" status of each. This morning, I tried to detect IDLE using "'idlelib.__main__' in sys.modules.keys()" and was able to fix the current bug by suppressing the mainloop and assuming that "Idle -n" is running and not "Idle". It would be much better to detect the mainloop directly though. Regards, Todd |