Terry J. Reedy added the comment:

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."

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11077>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to