Skip to content
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

The tkinter.filedialog module has no default values for arguments #11482

Open
Akuli opened this issue Feb 27, 2024 · 3 comments
Open

The tkinter.filedialog module has no default values for arguments #11482

Akuli opened this issue Feb 27, 2024 · 3 comments
Labels
topic: tkinter tkinter-related issues

Comments

@Akuli
Copy link
Collaborator

Akuli commented Feb 27, 2024

def asksaveasfilename(
*,
confirmoverwrite: bool | None = ...,
defaultextension: str | None = ...,
filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ...,
initialdir: StrOrBytesPath | None = ...,
initialfile: StrOrBytesPath | None = ...,
parent: Misc | None = ...,
title: str | None = ...,
typevariable: StringVar | str | None = ...,

The defaults are set to ..., because the code is dynamic (as is usual with tkinter), and the default values couldn't be filled in automatically when we introduced default values to typeshed. Setting reasonable default values would make the parameters easier to use, because IDEs tell you what each parameter does if you don't specify it.

This is similar to #10947, maybe a part of it.

@Akuli Akuli added the topic: tkinter tkinter-related issues label Feb 27, 2024
@Paulie-Aditya
Copy link
Contributor

easily fixable, but I would need to know what could the default values be

@Akuli
Copy link
Collaborator Author

Akuli commented Mar 6, 2024

I would look at tkinter's source code. It calls Tcl commands (like everything else in tkinter), in this case tk_getOpenFile, tk_getSaveFile and tk_chooseDirectory. Here are their manual pages that explain in detail how they work:

You can also just try and see what each parameter does.

@CTimmerman
Copy link

confirmoverwrite default is True in Windows 10. The filepicker produces a dialog to confirm saving to an already existing filename.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: tkinter tkinter-related issues
Projects
None yet
Development

No branches or pull requests

3 participants