Skip to content

Commit a4601d0

Browse files
[3.13] Use tkinter wrapper methods instead of raw Tcl calls in turtle and IDLE (GH-152414) (GH-152663)
* turtle: wm_attributes(topmost=...); * idlelib.macosx: winfo_server(); * idlelib tests: after_info(). (cherry picked from commit fc866dc) Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent d1ae643 commit a4601d0

15 files changed

Lines changed: 23 additions & 23 deletions

Lib/idlelib/idle_test/template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def setUpClass(cls):
1717
@classmethod
1818
def tearDownClass(cls):
1919
cls.root.update_idletasks()
20-
## for id in cls.root.tk.call('after', 'info'):
20+
## for id in cls.root.after_info():
2121
## cls.root.after_cancel(id) # Need for EditorWindow.
2222
cls.root.destroy()
2323
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
@@ -259,7 +259,7 @@ def test_notify_range(self):
259259

260260
# Colorizing already scheduled.
261261
save_id = color.after_id
262-
eq(self.root.tk.call('after', 'info', save_id)[1], 'timer')
262+
eq(self.root.after_info(save_id)[1], 'timer')
263263
self.assertFalse(color.colorizing)
264264
self.assertFalse(color.stop_colorizing)
265265
self.assertTrue(color.allow_colorizing)
@@ -276,7 +276,7 @@ def test_notify_range(self):
276276
color.notify_range('1.0', '1.0+3c')
277277
self.assertTrue(color.stop_colorizing)
278278
self.assertIsNotNone(color.after_id)
279-
eq(self.root.tk.call('after', 'info', color.after_id)[1], 'timer')
279+
eq(self.root.after_info(color.after_id)[1], 'timer')
280280
# New event scheduled.
281281
self.assertNotEqual(color.after_id, save_id)
282282

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

301301
# Toggle colorizing off.
302302
color.toggle_colorize_event()
@@ -323,7 +323,7 @@ def test_toggle_colorize_event(self):
323323
# Toggle on while colorizing not in progress.
324324
color.colorizing = False
325325
color.toggle_colorize_event()
326-
eq(self.root.tk.call('after', 'info', color.after_id)[1], 'timer')
326+
eq(self.root.after_info(color.after_id)[1], 'timer')
327327
self.assertFalse(color.colorizing)
328328
self.assertTrue(color.stop_colorizing)
329329
self.assertTrue(color.allow_colorizing)
@@ -362,7 +362,7 @@ def test_recolorize(self, mock_recmain):
362362
mock_recmain.assert_called()
363363
eq(mock_recmain.call_count, 1)
364364
# Rescheduled when TODO tag still exists.
365-
eq(self.root.tk.call('after', 'info', color.after_id)[1], 'timer')
365+
eq(self.root.after_info(color.after_id)[1], 'timer')
366366

367367
# No changes to text, so no scheduling added.
368368
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
@@ -31,7 +31,7 @@ def tearDownClass(cls):
3131
cls.editwin._close()
3232
del cls.editwin
3333
cls.root.update_idletasks()
34-
for id in cls.root.tk.call('after', 'info'):
34+
for id in cls.root.after_info():
3535
cls.root.after_cancel(id) # Need for EditorWindow.
3636
cls.root.destroy()
3737
del cls.root

Lib/idlelib/idle_test/test_multicall.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def setUpClass(cls):
2020
def tearDownClass(cls):
2121
del cls.mc
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) # Need for EditorWindow.
2525
cls.root.destroy()
2626
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)