This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients PythonInTheGrass, amaury.forgeotdarc, asvetlov, belopolsky, cgohlke, loewis, pitrou, terry.reedy
Date 2013-03-08.23:49:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1362786557.63.0.378661133952.issue11077@psf.upfronthosting.co.za>
In-reply-to
Content
I am somewhat puzzled by the claim that tkinter *is* thread safe (as opposed to *intended to be*), in the sense of accessing the gui from multiple threads. 

First, http://www.astro.washington.edu/users/rowen/TkinterSummary.html
"all Tkinter access must be from the main thread (or more precisely,
from the thread that calls the mainloop). Violating this is likely to
cause nasty and mysterious symptoms such as freezes and core dumps."

This statement must be based on some sort of experience.

Second, there have been many reports of problems with tkinter and threads. From currently open tracker issues:
#11029 Same Scott M as here fixed problem by feeding data to single gui thread with queue.
#16823 I turned this into a doc issue to say (perhaps erroneously) that tkinter is not thread safe, quoting the above.
#6933 I closed this as invalid because of using multiple threads.
#10909 This is ambiguous because problem continued after stopping 2nd thread access.
I believe these have most of the details requested.

There have been posts on python-list where people were advised to and solved problems by only accessing tkinter from one thread, and the main thread at that. Ditto for Stackoverflow: searching [python tkinter threads] gets 368 hits. Just one example:
http://stackoverflow.com/questions/13753545/tkinter-freeze-on-grid-remove/13753865#13753865 from Adrian Larsen got this response:

"Tkinter is not thread safe. If you do anything in a thread other than the main thread that touches a GUI object then you will get unpredictable results. ..." (Brian Oakley, experienced responder)

Adrian responded "... The real problem is that it is not in the correct thread (i.e. the mainloop). I solved the problem by sending the ungrid order to a queue in the GUI, which then issues the command from inside the mainloop."
History
Date User Action Args
2013-03-08 23:49:17terry.reedysetrecipients: + terry.reedy, loewis, amaury.forgeotdarc, belopolsky, pitrou, asvetlov, cgohlke, PythonInTheGrass
2013-03-08 23:49:17terry.reedysetmessageid: <1362786557.63.0.378661133952.issue11077@psf.upfronthosting.co.za>
2013-03-08 23:49:17terry.reedylinkissue11077 messages
2013-03-08 23:49:17terry.reedycreate