Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[tkinter.ttk] Added type annotations forStyle, fix some other incomplete parts#14348

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
MarcellPerger1 wants to merge11 commits intopython:main
base:main
Choose a base branch
Loading
fromMarcellPerger1:improve-tkinter-ttk

Conversation

MarcellPerger1
Copy link
Contributor

  • Added type annotations for methods intkinter.ttk.Style
  • 2 other functions improved (setup_master,Panedwindow.forget)

@github-actionsGitHub Actions

This comment has been minimized.

@github-actionsGitHub Actions

This comment has been minimized.

@MarcellPerger1
Copy link
ContributorAuthor

Is this a stubtest bug? Itsays

error: tkinter.ttk.Style.element_create is inconsistent, stub argument "elementname" has a default value but runtime argument does notStub: in file /home/runner/work/typeshed/typeshed/stdlib/tkinter/ttk.pyi:137

But on line 137, it has no default argument...
https://github.com/MarcellPerger1/typeshed/blob/c86e49931e093d6b9aadcc75d8588908a2c30274/stdlib/tkinter/ttk.pyi#L137-L158

It also seems to concatenate the overloaded functions' signatures together as it infers the signatue in the stub to be:

Inferred signature: def (self: tkinter.ttk.Style, elementname: builtins.str = ..., elementname: builtins.str = ..., etype: Literal['image'] = ..., etype: Literal['from'] = ..., _default_image: Union[tkinter._Image, builtins.str] = ..., themename: builtins.str = ..., fromelement: builtins.str = ..., *imagespec, border: Union[builtins.str, builtins.float, tuple[Union[builtins.str, builtins.float]], tuple[Union[builtins.str, builtins.float], Union[builtins.str, builtins.float]], tuple[Union[builtins.str, builtins.float], Union[builtins.str, builtins.float], Union[builtins.str, builtins.float]], tuple[Union[builtins.str, builtins.float], Union[builtins.str, builtins.float], Union[builtins.str, builtins.float], Union[builtins.str, builtins.float]]] = ..., height: Union[builtins.str, builtins.float] = ..., padding: Union[builtins.str, builtins.float, tuple[Union[builtins.str, builtins.float]], tuple[Union[builtins.str, builtins.float], Union[builtins.str, builtins.float]], tuple[Union[builtins.str, builtins.float], Union[builtins.str, builtins.float], Union[builtins.str, builtins.float]], tuple[Union[builtins.str, builtins.float], Union[builtins.str, builtins.float], Union[builtins.str, builtins.float], Union[builtins.str, builtins.float]]] = ..., sticky: builtins.str = ..., width: Union[builtins.str, builtins.float] = ...)

elementname appears twice after each other, there's two separateetype arguments... I have no clue what's going on here, but IMHO it doesn't look like the intended behavior

@github-actionsGitHub Actions
Copy link
Contributor

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

@MarcellPerger1
Copy link
ContributorAuthor

For thepre-commit.ci failure, I have no clue whyflake8 isn't recognizing the usage of_ElementCreateArgs online 110

stdlib/tkinter/ttk.pyi:97:5: Y047 Type alias "_ElementCreateArgs" is not used

# also be given positionally so are in practise positional-only). Therefore, stubtest complains.
# (I'm not sure if this is the best way to handle this - ignoring the
# stubtest error would result in stubs that actually match the code)
_default_image: tkinter._ImageSpec,
*imagespec: _ImageStatespec,
Copy link
Contributor

Choose a reason for hiding this comment

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

Kinda awkward but you could do*imagespec: *tuple[tkinter._ImageSpec, *tuple[_ImageStatespec, ...]]. Not sure if this would be problematic to use though for code completion though.

@AkuliAkuli self-assigned thisJun 29, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@TeamSpen210TeamSpen210TeamSpen210 left review comments

Assignees

@AkuliAkuli

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@MarcellPerger1@TeamSpen210@Akuli

[8]ページ先頭

©2009-2025 Movatter.jp