Tk with thread

Seung Chan Lim slim at maya.com
Fri Oct 27 15:43:23 EDT 2000


I'm just fooling around with threads and Tk...
I tried the following to simulate a case where
an existing Tk app could dynamically load
a module that also runs a Tk app on a thread.

It hangs on my box... could anybody tell me why
and how I can fix it? Is it the fact that another Tk
is being instantiated on a different thread?



from Tkinter import *
def bar():
        root=Tk()
        root.title("good bye world")
        
def foo():
        root=Tk()
        root.title("hello world")
        thread.start_new_thread(bar,())
        root.mainloop()
        
import thread
def go():
    foo()

go()
if __name__=="__main__":
    while 1:
        pass






More information about the Python-list mailing list