Re: [Tkinter-discuss] Simulating keystrokes in a tkinter unit test

2018-02-02 Thread Michael Lange
Hi, On Thu, 1 Feb 2018 23:52:34 -0600 alan moore 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 even

Re: [Tkinter-discuss] Simulating keystrokes in a tkinter unit test

2018-02-01 Thread alan moore
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. Thanks for your feedback! On 02/01/2018

Re: [Tkinter-discuss] Simulating keystrokes in a tkinter unit test

2018-02-01 Thread Bryan Oakley
You might need to also generate a event and/or move the mouse over the widget with the warp option (widget.event_generate(..., warp=True), but you may need to also specify an x and y coordinate. I don't remember). I think some widgets check to see if they have focus, and will ignore keyboard event