typeshed icon indicating copy to clipboard operation
typeshed copied to clipboard

The tkinter.filedialog module has no default values for arguments

Open Akuli opened this issue 1 year ago • 3 comments
trafficstars

https://github.com/python/typeshed/blob/6d20ea636ca7b66cec62f490ec9e42b63886c811/stdlib/tkinter/filedialog.pyi#L81-L90

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 avatar Feb 27 '24 20:02 Akuli

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

Paulie-Aditya avatar Mar 06 '24 05:03 Paulie-Aditya

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.

Akuli avatar Mar 06 '24 20:03 Akuli

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

CTimmerman avatar May 12 '24 20:05 CTimmerman

Still some defaults missing.

Akuli avatar Jan 01 '25 20:01 Akuli