Repository navigation
Conversation
Tk 9.0 lets ttk::progressbar show a text label and adds the anchor, font, foreground, justify, text and wraplength options. Progressbar has an explicit signature with no **kw, so passing any of them was a type error. Add them to __init__ and configure with the types ttk.Label uses. Closes python#16612
Contributor
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Author
|
The three failing |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #16612.
Tk 9.0 lets
ttk::progressbardisplay a text label inside the bar and adds six options for it:anchor,font,foreground,justify,textandwraplength(Tk 9.0 man page). Compared with the Tk 8.6 page, no options were removed; these six are the only difference.Progressbar.__init__andconfigurehave explicit signatures with no**kw, so code using these options is rejected onmain:This PR adds the six options to both, using the same types
ttk.Labeluses for them.tkintercan be built against Tk 8.6 or 9.0, and typeshed can't tell which one it is, so the options aren't version-gated. A comment notes they need Tk 9.0. On Tk 8.6, passing them is a runtime error rather than a type error, which follows typeshed's usual preference for false negatives over false positives.Checks:
tests/mypy_test.py stdlib/tkinter -p 3.10 -p 3.14,pyright,ruff,blackandcheck_typeshed_structure.pyall pass, and the example above type-checks cleanly with the change.