[Tkinter-discuss] multithreading

C. Allen callen at gemini.edu
Sat Jul 19 03:21:35 CEST 2008


Ok, for anyone interested it felt bad to do to tkinter but even more
importantly, it was not necessary to be so wasteful with threads, I
really only need a single GUI thread (I may not feel that way the first
time a problem in one window hangs them all), so I just redid things so
all the windows are created and controlled by a single thread, and I use
a list as a queue of commands from other threads (i.e. "open another set
of windows associated to xyz data").

cheers.

On Wed, 2008-07-16 at 15:09 -1000, Craig Allen wrote:

> Anyone that's interested,
> 
> I have a command line application which I want to run as such, with a
> flag that alternately puts up a pretty monitoring GUI that shows in
> more detail what's going on.  So fine, I run the Tk mainloop in a
> background thread. I've read and learned myself you cannot make your
> Tk calls outside this thread. Fine.
> 
> But as this is a bit of an extra feature I have not been particularly
> careful, and since the command line can execute more than one sequence
> of it's processing, it wants to open up a new pair of windows every
> time.  As I"m just hacking this together (the pretty Tk interface is
> an addition, not really required to be build) to do this I call the
> master object which is a threading object... i.e. another thread is
> started, and this other thread has a mainloop call in it.  It all
> works fine, but I'm sort of of the impression I'm not supposed to do
> this, that there should only be one thread running a mainloop call.  
> 
> Is that true, is this evil?
> 
> Any comments appreciated.
> 
> craig 
> 
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20080718/1a02d32f/attachment.htm>


More information about the Tkinter-discuss mailing list