multi-thread problem of python/Tkiner on windows

Alex Martelli aleax at aleax.it
Wed Oct 15 12:34:15 EDT 2003


York wrote:

> I just want to know whether python/Tkinter support multi-thread or not. As
> my experience, my GUI (based on Tkinter) program can run in multi-thread
> style on Linux, but on windows, it has to be turn to non-thread style,
> otherwise it will crash at once.

You should encapsulate your Tkinter GUI within one thread, dedicated to
just that job, and communicating with all other threads via instances
of Queue.  In my experience (with older releases of Python, Tkinter, and
Tk itself -- haven't tried with the current ones) this is also needed
on Linux -- making calls to Tkinter method from multiple threads can
cause crashes (and I think that is in fact documented).


Alex





More information about the Python-list mailing list