Skip to content

Commit 0f59b2a

Browse files
authored
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
1 parent c698243 commit 0f59b2a

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

Lib/idlelib/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
def fix_scaling(root): # Called in filelist _test, pyshell, and run.
2525
"""Scale fonts on HiDPI displays, once per process."""
2626
import tkinter.font
27-
scaling = float(root.tk.call('tk', 'scaling'))
27+
scaling = root.tk_scaling()
2828
if scaling > 1.4:
2929
for name in tkinter.font.names(root):
3030
font = tkinter.font.Font(root=root, name=name, exists=True)

Lib/test/test_tkinter/widget_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def scaling(self):
3434
try:
3535
return self._scaling
3636
except AttributeError:
37-
self._scaling = float(self.root.call('tk', 'scaling'))
37+
self._scaling = self.root.tk_scaling()
3838
return self._scaling
3939

4040
def _str(self, value):

0 commit comments

Comments
 (0)