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?

This is the way I have things right now (not in its entirety):
-----
start.py
import threading
import thread
import time
import GUIFramework
import myFoo
class guiThread(threading.Thread):
    def __init__(self, threadID, name):
        self.threadID = threadID
        self.name = name
        self.guiFrame = GUIFramework(master=None)
        threading.Thread.__init__(self)
    def run(self):
        print "Starting " + self.name
        self.guiFrame.mainloop()
        print "Exiting " + self.name

class mainThread(threading.Thread):
    def __init__(self, threadID, name):
        self.threadID = threadID
        self.name = name
        self.myFoo = myFoo()
        threading.Thread.__init__(self)
    def run(self):
        print "Starting " + self.name
        self.myFoo.alive()
        print "Exiting " + self.name

def start():
    """ Start """
    #Create new threads
    threadgui = guiThread(1, "threadgui")
    threadmain= carlThread(2, "threadmain")
    #Start new Threads
    threadgui.start()
    threadmain.run()
    while threadmain.isAlive():
        if not threadgui.isAlive():
            doExit = 1
    pass
    print "Exiting Main Thread"

if __name__ == '__main__':
    start()

-----
I've tried a fews things but I really haven't had any luck.
-- 
Thanks, Joe
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to