[Image-SIG] Tkinter, ImageTk and threading...

Klamer Schutte Schutte@fel.tno.nl
Fri, 23 Aug 2002 17:29:27 +0200

It is my understanding that Tkinter allows only one thread to
access the Tk things. This seems to be Tk/Tcl related.

A solution in multi-threaded applications is to make one thread 
which is only responsible for accessing tkinter. Communicate
to that thread using a Queue, and regular call Tk.update(), as
calling Tk.mainloop() will not read the Queue.


"Kevin@Cazabon.com" wrote:
> Has anyone else had problems using Tkinter to display images in
> multi-threaded applications?
> I keep getting "Access Violation"s in TCL80.dll, and can't seem to nail down
> exactly what's happening.  I've put locks on everything that can be accessed
> by more than one thread, and made sure that I'm not changing things
> underneath of Tcl on the fly, but to no avail.
> I believe the issue is related to images that are being shown on-screen in a
> Label widget.
> I don't have specifics yet, just wondering if anyone knows of any
> threading-specific shortfalls of Tkinter/Tcl that I should be wary of.
> Thanks!
> Kevin Cazabon.
> _______________________________________________
> Image-SIG maillist  -  Image-SIG@python.org
> http://mail.python.org/mailman/listinfo/image-sig