https://github.com/python/cpython/commit/0f59b2a800d2f91b863c80c92b64966a8ed28515
commit: 0f59b2a800d2f91b863c80c92b64966a8ed28515
branch: main
author: Terry Jan Reedy <[email protected]>
committer: terryjreedy <[email protected]>
date: 2026-07-01T15:08:37Z
summary:
Use tk_scaling() instead of a raw Tcl call in IDLE and tkinter tests (#152788)
Replace `tk.call('tk', 'scaling')` with `tk_scaling()`, which
returns a float, in idlelib.util and test_tkinter.widget_tests.
Co-authored-by: serhiy-storchaka
files:
M Lib/idlelib/util.py
M Lib/test/test_tkinter/widget_tests.py
diff --git a/Lib/idlelib/util.py b/Lib/idlelib/util.py
index bf88c905e1d177d..bdf02892de68ea9 100644
--- a/Lib/idlelib/util.py
+++ b/Lib/idlelib/util.py
@@ -24,7 +24,7 @@
def fix_scaling(root): # Called in filelist _test, pyshell, and run.
"""Scale fonts on HiDPI displays, once per process."""
import tkinter.font
- scaling = float(root.tk.call('tk', 'scaling'))
+ scaling = root.tk_scaling()
if scaling > 1.4:
for name in tkinter.font.names(root):
font = tkinter.font.Font(root=root, name=name, exists=True)
diff --git a/Lib/test/test_tkinter/widget_tests.py
b/Lib/test/test_tkinter/widget_tests.py
index 014906cba2902c3..05e60f7ee118e35 100644
--- a/Lib/test/test_tkinter/widget_tests.py
+++ b/Lib/test/test_tkinter/widget_tests.py
@@ -34,7 +34,7 @@ def scaling(self):
try:
return self._scaling
except AttributeError:
- self._scaling = float(self.root.call('tk', 'scaling'))
+ self._scaling = self.root.tk_scaling()
return self._scaling
def _str(self, value):
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]