From e41479ea21e86d46bf8ae7815ddd7438f08209d2 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sun, 28 Jun 2026 06:54:27 +0300 Subject: [PATCH] Use tk_scaling() instead of a raw Tcl call in IDLE and tkinter tests * idlelib.run.fix_scaling(): root.tk_scaling() instead of float(root.tk.call('tk', 'scaling')); * tkinter widget tests: root.tk_scaling() instead of float(root.call('tk', 'scaling')). Co-Authored-By: Claude Opus 4.8 --- Lib/idlelib/run.py | 2 +- Lib/test/test_tkinter/widget_tests.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py index e1c40fee8f48053..c3f869ec4d75bd1 100644 --- a/Lib/idlelib/run.py +++ b/Lib/idlelib/run.py @@ -392,7 +392,7 @@ def exit(): def fix_scaling(root): """Scale fonts on HiDPI displays.""" 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 94244a8b3fe2448..7162dfb1958b006 100644 --- a/Lib/test/test_tkinter/widget_tests.py +++ b/Lib/test/test_tkinter/widget_tests.py @@ -24,7 +24,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):