Why not event-driven packages in other than the main thread?

Lawrence Oluyede rhymes at myself.com
Thu Sep 14 06:28:16 EDT 2006

Tor Erik <torerik81 at gmail.com> wrote:
> I've developed an application were I've used Tkinter for the GUI.
> When I ran the GUI in another thread than the main, it kept locking
> up.

That's because Tkinter is not thread safe AFAIK.

> I experienced similar problems with Twisted.

Neither Twisted is thread-aware. It uses thread for a couple of things
(twisted.row and address resolution). You can call stuff in a separate
thread with deferToThread or callInThread but avoid threads is best. 

> But could anyone tell me why running these in a thread other than the
> main one doesn't work?

Because neither Twisted nor Tkinter are meant to work with threads.

Lawrence - http://www.oluyede.org/blog
"Nothing is more dangerous than an idea
if it's the only one you have" - E. A. Chartier

More information about the Python-list mailing list