> This sounds like you are trying to access tk from within two different > threads which is generally a bad idea, though it may *seem* to work > sometimes. > Maybe we can provide better help if you could post a short code snippet > that demonstrates your problem. > > Regards > > Michael >
Hi Michael, I'm trying to write a basic GUI testing tool (in fact, I'm trying to add basic Tkinter support to PyUseCase, which has only worked with PyGTK so far) The basic plan when replaying is thus to add an idle handler that can generate GUI events for me. I assumed I would just do root.after_idle(self.replayEvents) as I do with PyGTK, but as discussed that failed because it tried to simulate events before the widgets were mapped and hence ready to receive the events. Instead I have now done the following: thread = Thread(target=self.addIdleHandler) thread.run() def addIdleHandler(self): root.wait_visibility() root.after_idle(self.replayEvents) def replayEvents(self): root.update_idletasks() # ... actually do stuff I must say I don't understand how wait_visibility would work if I didn't call it in a different thread. I can't call it in the main thread or it will cause deadlock, surely? It is that thread that is going to map my widgets so I can't block in it waiting for that to happen. As you can see, the thread is only adding the idle handler, it isn't actually doing anything with the widgets itself. Regards, Geoff _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss