Skip to content

Use tk_scaling() instead of a raw Tcl call in IDLE and tkinter tests#152465

Closed
serhiy-storchaka wants to merge 2 commits into
python:mainfrom
serhiy-storchaka:tkinter-stdlib-tk-scaling
Closed

Use tk_scaling() instead of a raw Tcl call in IDLE and tkinter tests#152465
serhiy-storchaka wants to merge 2 commits into
python:mainfrom
serhiy-storchaka:tkinter-stdlib-tk-scaling

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

Replace explicit tk.call() invocations with tk_scaling(), which already returns a float. No behavior change.

  • 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')).

Split out from GH-152414 because tk_scaling() was only added in 3.16 (gh-151881), so this part is not backported.

* 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 <noreply@anthropic.com>

@terryjreedy terryjreedy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will move fix_scaling to idlelib.util after this is merged.

@terryjreedy

Copy link
Copy Markdown
Member

On second thought, it would be much easier to backport the move first, with the body the same in all versions, and then revise or replace this main-only PR. What do you think?

@serhiy-storchaka

Copy link
Copy Markdown
Member Author

This is up to you. This change is tiny and can easily be applied manually.

@terryjreedy

Copy link
Copy Markdown
Member

Functions, including fix_scaling, moved to util.py in #152728.

@terryjreedy

Copy link
Copy Markdown
Member

I will write a replacement later today (easy) unless you do. And respond to multiple comments on IDLE isssues.

@serhiy-storchaka serhiy-storchaka deleted the tkinter-stdlib-tk-scaling branch July 1, 2026 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants