Skip to content

Commit

Permalink
Add some defaults to tkinter.filedialog (python#13345)
Browse files Browse the repository at this point in the history
Partially fixes: python#11482

Source of fixes based on the @Akuli comment: python#11482 (comment)
  • Loading branch information
kbaikov authored and hoel-bagard committed Jan 5, 2025
1 parent 8c5b95d commit e096744
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions stdlib/tkinter/filedialog.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ class Directory(commondialog.Dialog):
# TODO: command kwarg available on macos
def asksaveasfilename(
*,
confirmoverwrite: bool | None = ...,
defaultextension: str | None = ...,
confirmoverwrite: bool | None = True,
defaultextension: str | None = "",
filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ...,
initialdir: StrOrBytesPath | None = ...,
initialfile: StrOrBytesPath | None = ...,
Expand All @@ -91,7 +91,7 @@ def asksaveasfilename(
) -> str: ... # can be empty string
def askopenfilename(
*,
defaultextension: str | None = ...,
defaultextension: str | None = "",
filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ...,
initialdir: StrOrBytesPath | None = ...,
initialfile: StrOrBytesPath | None = ...,
Expand All @@ -101,7 +101,7 @@ def askopenfilename(
) -> str: ... # can be empty string
def askopenfilenames(
*,
defaultextension: str | None = ...,
defaultextension: str | None = "",
filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ...,
initialdir: StrOrBytesPath | None = ...,
initialfile: StrOrBytesPath | None = ...,
Expand All @@ -110,15 +110,15 @@ def askopenfilenames(
typevariable: StringVar | str | None = ...,
) -> Literal[""] | tuple[str, ...]: ...
def askdirectory(
*, initialdir: StrOrBytesPath | None = ..., mustexist: bool | None = ..., parent: Misc | None = ..., title: str | None = ...
*, initialdir: StrOrBytesPath | None = ..., mustexist: bool | None = False, parent: Misc | None = ..., title: str | None = ...
) -> str: ... # can be empty string

# TODO: If someone actually uses these, overload to have the actual return type of open(..., mode)
def asksaveasfile(
mode: str = "w",
*,
confirmoverwrite: bool | None = ...,
defaultextension: str | None = ...,
confirmoverwrite: bool | None = True,
defaultextension: str | None = "",
filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ...,
initialdir: StrOrBytesPath | None = ...,
initialfile: StrOrBytesPath | None = ...,
Expand All @@ -129,7 +129,7 @@ def asksaveasfile(
def askopenfile(
mode: str = "r",
*,
defaultextension: str | None = ...,
defaultextension: str | None = "",
filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ...,
initialdir: StrOrBytesPath | None = ...,
initialfile: StrOrBytesPath | None = ...,
Expand All @@ -140,7 +140,7 @@ def askopenfile(
def askopenfiles(
mode: str = "r",
*,
defaultextension: str | None = ...,
defaultextension: str | None = "",
filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ...,
initialdir: StrOrBytesPath | None = ...,
initialfile: StrOrBytesPath | None = ...,
Expand Down

0 comments on commit e096744

Please sign in to comment.