Eric Firing wrote:
I updated from CVS, made a one-line change to contour.py to add alpha support, and tested using contour_demo.py from bash shell--and found that with linux default gtk-agg backend, the gtk.main() doesn't return when the plot window is closed. I have to Ctl-C to get out.
The following patch fixes the problem for me, and makes sense to me:
RCS file: /cvsroot/matplotlib/matplotlib/lib/matplotlib/backends/backend_gtk.py,v
retrieving revision 1.123
diff -u -r1.123 backend_gtk.py
--- backend_gtk.py 24 Feb 2006 20:00:28 -0000 1.123
+++ backend_gtk.py 26 Feb 2006 02:30:42 -0000
@@ -76,8 +76,8 @@
if mainloop and gtk.main_level() == 0:
show._mainloop = True
show._mainloop = False
def new_figure_manager(num, *args, **kwargs):
You have show._mainloop = True after the call to gtk.main(), but that doesn't return; when the windows are deleted, the mainloop is still running but the flag has not been set, so deleting the last window does not end the loop. So the obvious solution (above) is to set the flag before calling gtk.main()
I was about to simply make the change, but decided to leave it to you, since I don't understand the bug you were trying to fix in the first place. Maybe some sort of locking is actually needed to make sure nothing unexpected can happen in another thread between the setting of the flag and the call to gtk.main().