TK + cmd.cmdloop() in threads (was Re: howdoI: Exception in thread - terminating the program?

Aahz Maruch aahz at panix.com
Sat Jul 28 07:46:49 CEST 2001


In article <yox3d7o1a8k.fsf at karhu.tp.spt.fi>,
Ville Vainio  <vvainio at karhu.tp.spt.fi> wrote:
>aahz at panix.com (Aahz Maruch) writes:
>>
>> Generally speaking, it's safest to have only one thread accessing any
>> external resource (GUI, file handle, DB connection, etc).
>
>But one would think it's reasonably safe to access a resource one
>thread at a time, via mutexes etc. (and some external resource, such
>as sockets, almost *have to* be accessed in multiple threads). Is TK
>really such a beast that all the access to TK widgets have to be called
>via it's own event loop?

One might think that.  One would even be technically accurate.  But
writing threaded programs is difficult enough; I always recommend that
people put each external resource into a separate thread, and if they
want to hang themselves it's no skin off my nose.
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista   

Fortune cookie: Watch your relations with other people carefully, be reserved.



More information about the Python-list mailing list