[Tkinter-discuss] Tkinter and Threads

Stewart Midwinter stewart.midwinter at gmail.com
Sat Feb 5 02:54:47 CET 2005


After reading your post I'm reminded of a scene early in Ghostbusters
I where Venkmann says "whatever you do, don't cross the rays (threads)
! That would be very, very, bad! "

Russell Owen's page of 'common Tkinter pitfalls and how to avoid
them', at the following URL:
http://www.astro.washington.edu/rowen/TkinterSummary.html, says that
"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.
Yes, this makes combining multi-threading and Tkinter very difficult.
The only fully safe technique I have found it polling (e.g. use
'freeze' from the main loop to poll a threading Queue that your thread

since you have two separate threads both working on the same widgets,
the surprising thing may not be that you are having difficulties, but
rather that it worked at all!


Stewart Midwinter
stewart at midwinter.ca
stewart.midwinter at gmail.com

More information about the Tkinter-discuss mailing list