From 0efb55123cccc3ecf9f67c9dce2d91b7937b139b Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Wed, 1 Jul 2026 09:50:49 -0400 Subject: [PATCH 1/2] 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 | 2 +- Lib/test/test_tkinter/widget_tests.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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..8a728ded70e0165 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 = root.tk_scaling() return self._scaling def _str(self, value): From f9b583208acb8a83b62ad43898731a7355a72360 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Wed, 1 Jul 2026 10:41:31 -0400 Subject: [PATCH 2/2] Add omitted self. --- Lib/test/test_tkinter/widget_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_tkinter/widget_tests.py b/Lib/test/test_tkinter/widget_tests.py index 8a728ded70e0165..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 = root.tk_scaling() + self._scaling = self.root.tk_scaling() return self._scaling def _str(self, value):