Event for multithread help advice

Aahz aahz at pythoncraft.com
Tue Oct 30 10:44:07 EDT 2007


In article <mailman.512.1193502460.13605.python-list at python.org>,
JoeSox  <joesox at gmail.com> wrote:
>
>I have two threads going
>class guiThread(threading.Thread)
>class mainThread(threading.Thread)
>
>Within the guiThread, I have an instance of class GUIFramework(Frame)
>in this Tkinter instance I have a ListBox.
>
>The second thread, mainThread, has an instance of a custom class the
>will need to send out text or other objects to the gui.
>
>What is the best or easiest way to send, let's say text, from
>mainThread to the guiThread ListBox?
>
>Should I use a custom Event class, pubsub, or Queue?

Well, I'd recommend a Queue, but that's partly because I have an example
already made up:
http://www.pythoncraft.com/OSCON2001/FibThreaded.py
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Typing is cheap.  Thinking is expensive."  --Roy Smith



More information about the Python-list mailing list