Skip to content

Commit ea032fc

Browse files
Use tkinter wrapper methods instead of raw Tcl calls in turtle and IDLE
* turtle: wm_attributes(topmost=...); * idlelib.macosx: winfo_server(); * idlelib tests: after_info(). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 3fa72d5 commit ea032fc

16 files changed

Lines changed: 24 additions & 24 deletions

Lib/idlelib/idle_test/template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def setUpClass(cls):
1616
@classmethod
1717
def tearDownClass(cls):
1818
cls.root.update_idletasks()
19-
## for id in cls.root.tk.call('after', 'info'):
19+
## for id in cls.root.after_info():
2020
## cls.root.after_cancel(id) # Need for EditorWindow.
2121
cls.root.destroy()
2222
del cls.root

Lib/idlelib/idle_test/test_codecontext.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def test_del_with_timer(self):
127127
timer = self.cc.t1 = self.text.after(10000, lambda: None)
128128
self.cc.__del__()
129129
with self.assertRaises(TclError) as cm:
130-
self.root.tk.call('after', 'info', timer)
130+
self.root.after_info(timer)
131131
self.assertIn("doesn't exist", str(cm.exception))
132132

133133
def test_reload(self):
@@ -151,7 +151,7 @@ def test_toggle_code_context_event(self):
151151
eq(cc.context['bg'], self.highlight_cfg['background'])
152152
eq(cc.context.get('1.0', 'end-1c'), '')
153153
eq(cc.editwin.label, 'Hide Code Context')
154-
eq(self.root.tk.call('after', 'info', self.cc.t1)[1], 'timer')
154+
eq(self.root.after_info(self.cc.t1)[1], 'timer')
155155

156156
# Toggle off.
157157
toggle()

Lib/idlelib/idle_test/test_colorizer.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def test_notify_range(self):
260260

261261
# Colorizing already scheduled.
262262
save_id = color.after_id
263-
eq(self.root.tk.call('after', 'info', save_id)[1], 'timer')
263+
eq(self.root.after_info(save_id)[1], 'timer')
264264
self.assertFalse(color.colorizing)
265265
self.assertFalse(color.stop_colorizing)
266266
self.assertTrue(color.allow_colorizing)
@@ -277,7 +277,7 @@ def test_notify_range(self):
277277
color.notify_range('1.0', '1.0+3c')
278278
self.assertTrue(color.stop_colorizing)
279279
self.assertIsNotNone(color.after_id)
280-
eq(self.root.tk.call('after', 'info', color.after_id)[1], 'timer')
280+
eq(self.root.after_info(color.after_id)[1], 'timer')
281281
# New event scheduled.
282282
self.assertNotEqual(color.after_id, save_id)
283283

@@ -297,7 +297,7 @@ def test_toggle_colorize_event(self):
297297
self.assertFalse(color.colorizing)
298298
self.assertFalse(color.stop_colorizing)
299299
self.assertTrue(color.allow_colorizing)
300-
eq(self.root.tk.call('after', 'info', color.after_id)[1], 'timer')
300+
eq(self.root.after_info(color.after_id)[1], 'timer')
301301

302302
# Toggle colorizing off.
303303
color.toggle_colorize_event()
@@ -324,7 +324,7 @@ def test_toggle_colorize_event(self):
324324
# Toggle on while colorizing not in progress.
325325
color.colorizing = False
326326
color.toggle_colorize_event()
327-
eq(self.root.tk.call('after', 'info', color.after_id)[1], 'timer')
327+
eq(self.root.after_info(color.after_id)[1], 'timer')
328328
self.assertFalse(color.colorizing)
329329
self.assertTrue(color.stop_colorizing)
330330
self.assertTrue(color.allow_colorizing)
@@ -363,7 +363,7 @@ def test_recolorize(self, mock_recmain):
363363
mock_recmain.assert_called()
364364
eq(mock_recmain.call_count, 1)
365365
# Rescheduled when TODO tag still exists.
366-
eq(self.root.tk.call('after', 'info', color.after_id)[1], 'timer')
366+
eq(self.root.after_info(color.after_id)[1], 'timer')
367367

368368
# No changes to text, so no scheduling added.
369369
text.tag_remove('TODO', '1.0', 'end')

Lib/idlelib/idle_test/test_editor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def setUpClass(cls):
2020
@classmethod
2121
def tearDownClass(cls):
2222
cls.root.update_idletasks()
23-
for id in cls.root.tk.call('after', 'info'):
23+
for id in cls.root.after_info():
2424
cls.root.after_cancel(id)
2525
cls.root.destroy()
2626
del cls.root
@@ -114,7 +114,7 @@ def tearDownClass(cls):
114114
cls.window._close()
115115
del cls.window
116116
cls.root.update_idletasks()
117-
for id in cls.root.tk.call('after', 'info'):
117+
for id in cls.root.after_info():
118118
cls.root.after_cancel(id)
119119
cls.root.destroy()
120120
del cls.root
@@ -225,7 +225,7 @@ def tearDownClass(cls):
225225
cls.window._close()
226226
del cls.window
227227
cls.root.update_idletasks()
228-
for id in cls.root.tk.call('after', 'info'):
228+
for id in cls.root.after_info():
229229
cls.root.after_cancel(id)
230230
cls.root.destroy()
231231
del cls.root

Lib/idlelib/idle_test/test_filelist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def setUpClass(cls):
1616
@classmethod
1717
def tearDownClass(cls):
1818
cls.root.update_idletasks()
19-
for id in cls.root.tk.call('after', 'info'):
19+
for id in cls.root.after_info():
2020
cls.root.after_cancel(id)
2121
cls.root.destroy()
2222
del cls.root

Lib/idlelib/idle_test/test_iomenu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def tearDownClass(cls):
3030
cls.editwin._close()
3131
del cls.editwin
3232
cls.root.update_idletasks()
33-
for id in cls.root.tk.call('after', 'info'):
33+
for id in cls.root.after_info():
3434
cls.root.after_cancel(id) # Need for EditorWindow.
3535
cls.root.destroy()
3636
del cls.root

Lib/idlelib/idle_test/test_multicall.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def setUpClass(cls):
1919
def tearDownClass(cls):
2020
del cls.mc
2121
cls.root.update_idletasks()
22-
## for id in cls.root.tk.call('after', 'info'):
22+
## for id in cls.root.after_info():
2323
## cls.root.after_cancel(id) # Need for EditorWindow.
2424
cls.root.destroy()
2525
del cls.root

Lib/idlelib/idle_test/test_pyshell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def setUpClass(cls):
4040
@classmethod
4141
def tearDownClass(cls):
4242
#cls.root.update_idletasks()
43-
## for id in cls.root.tk.call('after', 'info'):
43+
## for id in cls.root.after_info():
4444
## cls.root.after_cancel(id) # Need for EditorWindow.
4545
cls.root.destroy()
4646
del cls.root

Lib/idlelib/idle_test/test_runscript.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def setUpClass(cls):
1818
@classmethod
1919
def tearDownClass(cls):
2020
cls.root.update_idletasks()
21-
for id in cls.root.tk.call('after', 'info'):
21+
for id in cls.root.after_info():
2222
cls.root.after_cancel(id) # Need for EditorWindow.
2323
cls.root.destroy()
2424
del cls.root

Lib/idlelib/idle_test/test_stackviewer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def setUpClass(cls):
2121
def tearDownClass(cls):
2222

2323
cls.root.update_idletasks()
24-
## for id in cls.root.tk.call('after', 'info'):
24+
## for id in cls.root.after_info():
2525
## cls.root.after_cancel(id) # Need for EditorWindow.
2626
cls.root.destroy()
2727
del cls.root

0 commit comments

Comments
 (0)