]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Use tk_scaling() instead of a raw Tcl call in IDLE and tkinter tests (#152788)
authorTerry Jan Reedy <tjreedy@udel.edu>
Wed, 1 Jul 2026 15:08:37 +0000 (11:08 -0400)
committerGitHub <noreply@github.com>
Wed, 1 Jul 2026 15:08:37 +0000 (15:08 +0000)
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
Lib/idlelib/util.py
Lib/test/test_tkinter/widget_tests.py

index bf88c905e1d177d7ca82d0f68a62c603e96e5a43..bdf02892de68ea9236a8db423342030fe847d2f3 100644 (file)
@@ -24,7 +24,7 @@ py_extensions = ('.py', '.pyw', '.pyi')
 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)
index 014906cba2902c34656159c11414197518fc52e5..05e60f7ee118e35efb4c9d4af691bfacf5911df1 100644 (file)
@@ -34,7 +34,7 @@ class AbstractWidgetTest(AbstractTkTest):
         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):