Skip to content

Remove the first few FloatInts in tkinter - #16889

Open
Akuli wants to merge 3 commits into
python:mainfrom
Akuli:tkinter-floatint-first
Open

Akuli wants to merge 3 commits into
python:mainfrom
Akuli:tkinter-floatint-first

Conversation

@Akuli

@Akuli Akuli commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator

I might do more in a future PR, but it's low-hanging fruit that someone else will probably do first. I still want to review the result, because tkinter is surprisingly tricky.

  • For most things that represent pixels, float values are rounded to the closest integer. This applies to most sizes, xy coordinates, paddings and border widths. (The | str in these argument types represent numbers with units, e.g. "10c".)
  • I tried to put the most commonly used types first. For example, label text is str | int | float, because it is almost always specified as a string.
  • The two arguments of xscrollcommand/yscrollcommand callback look like ('0.0', '1.0'), but the stub said FloatInt. The past me probably used xscrollcommand=print to incorrectly guess that they are float.

@Akuli Akuli changed the title Remove the first few FloatInts in stdlib/tkinter/__init__.pyi Remove the first few FloatInts in tkinter Nov 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant