Re: Simulating keystrokes in a tkinter unit test
Michael Lange <[email protected]> Fri, 2 Feb 2018 10:47:55 +0100
| Newsgroups | gmane.comp.python.tkinter |
|---|---|
| Message-ID | <[email protected]> |
Hi, On Thu, 1 Feb 2018 23:52:34 -0600 alan moore <[email protected]> wrote: > Thanks. I managed to work it out. I think the problem was twofold: > > - I needed to call self.mywidget.focus_force(), because my test root > wasn't getting focus > - I needed to call self.root.update() before *and* after the key events > > This got it working. Here (debian linux) the test also works if I just change the setUp() method like this: def setUp(self): super().setUp() self.mywidget = self.create() self.mywidget.wait_visibility() self.mywidget.update_idletasks() self.mywidget.focus_set() Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. Is not that the nature of men and women -- that the pleasure is in the learning of each other? -- Natira, the High Priestess of Yonada, "For the World is Hollow and I Have Touched the Sky", stardate 5476.3. _______________________________________________ Tkinter-discuss mailing list [email protected] https://mail.python.org/mailman/listinfo/tkinter-discuss