Tk not displaying correctly
Tuvas
tuvas21 at gmail.com
Wed Dec 21 17:31:33 EST 2005
I am building a TK interface, that has several threads. If all threads
are running actively, including the main one, the interface doesn't
update. For example, I have something like this, although more complex
import time, threading
master=Tk()
def thread:
global x
x=0
while(TRUE):
x=x+1
Label(master,text=x).grid(row=0,column=0)
time.sleep(1)
but=Button(master,command=command,text="hit me")
but.grid(row=0,column=0)
def command:
while(x<100):
time.sleep(1)
x=0
t=threading.Thread(target=thread)
t.setDaemon(1)
t.start()
master.mainloop()
What (I think) will happen is when you hit the button, until x=100, the
display will stop updating, and when the command has left it's thread,
it will return to updating again. Is there a way to make it so it
always will update, irreguardless if it's in a seporate thread, perhaps
calling a new thread that calls mainloop? Thanks!
More information about the Python-list
mailing list