Threading/TkInter problems with Buttons.

Marc mnations at airmail.net
Thu Mar 14 17:07:55 EST 2002


I was trying to start a thread from a button to find that it would not
work. The problem was that every time I started the application, the
thread would automatically kick off:


self.Go["command"] = self.thread1.start()


I eventually put an extra step in the process and had the Go command
call a function, which then called the thread. This worked:

self.thread1 = Thread(target = self.cb)
...
def go_thread(self):
		self.thread1.start()

def cb(self):
		while self.ok:
			printAll( self.ipaddr.get(), self.var.get() )
...
self.Go["command"] = self.go_thread


Why does it not work when you hook it up to the button, and is there a
way around this problem.

Thanks,
Marc



More information about the Python-list mailing list