2010/10/2 Eric Firing <efir...@hawaii.edu>: > On 10/01/2010 09:40 AM, Friedrich Romstedt wrote: >> There were several question on the user's list in the recent past >> reporting hangs and similar when using TkAgg backend& interactive >> mode. >> >> It is known that Tkinter doesn't play well with threading, as long as >> one isn't done very carefully. >> >> It could be that matplotlib has implemented it in a way not safe for >> Tkinter. This applies if there are Tkinter methods called from >> threads other than those which imported Tkinter. >> >> It results in unpredicatable behaviour with exactly the features >> reported: Hang-ups, blankening, partial hangup of part of the threads. >> >> Is a rewrite of the Tk interactive code necessary? > > I don't see any use of the threading module in backend_tkagg.py or > backend_bases.py. Is that what you are referring to? > > Ipython -pylab does use threads (version 0.10), but is intended to avoid > problems by running all user code in a single separate thread.
I just dived a bit into the matplotlib source code, and come up with partial answers: When interactive mode is on, the mainloop isn't running at all (see backend_bases.py:ShowBase). This explains hang-ups when using interactive mode in a non-shell Python call. Second, I would be very interested in more information about the ipython -pylab threading. What do you mean with "running all user code in a single separate thread"? When it's not the thread importing Tkinter, the problem persists. Tkinter is always cumbersome and needs lots of care ... (at least as soon as the program wants to do something useful :-) Also, I cannot see (with reasonable effort) how Threads play a role in matplotlib. I see there is the Scheduler class in cbook.py, and in backends/backend_tkagg.py there is "a dict from func-> cbook.Scheduler threads", but I have no idea how this works. A small hint in the correct direction would be appreciated! I think it's just a lot faster although I'm borrowing your time for writing the answer ... I cannot find any reference to ``.sourced`` in any matplotlib code. Maybe it's simply dead? Friedrich ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel