Skip to content

Complete ttkthemes #13858

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

donBarbos
Copy link
Contributor

I removed kwargs as a parameter for some methods since all the parameters used were already listed

This comment has been minimized.

@AlexWaygood AlexWaygood requested a review from Akuli April 20, 2025 22:12
def get_temp_directory(): ...
def get_themes_directory(theme_name: Incomplete | None = None, png: bool = False): ...
def create_directory(directory): ...
def temporary_chdir(new_dir: FileDescriptorOrPath) -> None: ...
Copy link
Collaborator

@Akuli Akuli Apr 21, 2025

Choose a reason for hiding this comment

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

This actually returns a ContextManager, because it is decorated with @contextmanager.

That said, I think we should delete _imgops.pyi and _utils.pyi from typeshed. They are not intended to be imported by users of this library.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

choosing between AbstractContextManager[None] and Generator[None] I took the latter (P.S.: ContextManager from typing is deprecated)

I don't think the types for these functions will get in the way for our type stubs, and many 3rd party libs have types for utils functions

I suggest leaving them

Copy link
Member

Choose a reason for hiding this comment

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

Generator[None] is wrong because that's not what the function returns when called.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry, changed to AbstractContextManager[None].
it was a suggestion from my lsp server :)

@@ -21,10 +21,56 @@ class ThemedTk(tkinter.Tk, ThemedWidget):
background: bool | None = ..., # old alias for themebg
gif_override: bool = ...,
) -> None: ...
def set_theme(self, theme_name, toplevel: bool | None = None, themebg: bool | None = None) -> None: ...
def set_theme(self, theme_name: str, toplevel: bool | None = None, themebg: bool | None = None) -> None: ...
# TODO: currently no good way to say "use the same big list of kwargs as parent class but also add these"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe this comment should be replaced with something like "Please keep this in sync with tkinter.Tk"? You should also add corresponding comment to stubs of tkinter.Tk in stdlib, so that if one is changed, the other is changed as well. Otherwise these may get out of sync over time (although tkinter stubs are quite stable now).

Copy link
Contributor

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

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.

3 participants