Skip to content

Commit c0a3971

Browse files
Do not check the focus on Windows
The application can lose the focus when the dialog is destroyed, and "focus" without -force does not take it back.
1 parent 8ba6469 commit c0a3971

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

‎Lib/test/test_tkinter/test_simpledialog.py‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,14 +257,13 @@ def test_go_foreign_grab(self):
257257
tk.call('update')
258258
tk.call('grab', 'set', '.foreign')
259259
tk.call('focus', '-force', '.foreign')
260-
# On Windows the application may not get the focus, and then "focus"
261-
# returns an empty string.
262-
has_focus = tk.call('focus') == '.foreign'
263260
d = self.create()
264261
d.root.after(1, lambda: d._buttons[0].invoke())
265262
self.assertEqual(d.go(), 0)
266263
self.assertEqual(tk.call('grab', 'current', self.root._w), '.foreign')
267-
if sys.platform != 'win32' or has_focus:
264+
# On Windows the application can lose the focus when the dialog is
265+
# destroyed, and then "focus" returns an empty string.
266+
if sys.platform != 'win32':
268267
self.assertEqual(tk.call('focus'), '.foreign')
269268

270269

0 commit comments

Comments
 (0)