From 38037ed096df74338fbb58355e5b384eca9f5b6b Mon Sep 17 00:00:00 2001 From: Bortlesboat <169967362+Bortlesboat@users.noreply.github.com> Date: Sun, 25 Oct 2026 13:22:59 -0400 Subject: [PATCH] [tkinter] Fill in remaining tkinter.filedialog defaults --- stdlib/tkinter/filedialog.pyi | 78 ++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/stdlib/tkinter/filedialog.pyi b/stdlib/tkinter/filedialog.pyi index b6ef8f45d035..ba69e90aa2da 100644 --- a/stdlib/tkinter/filedialog.pyi +++ b/stdlib/tkinter/filedialog.pyi @@ -80,35 +80,39 @@ def asksaveasfilename( *, confirmoverwrite: bool | None = True, 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 = ..., + filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] = (), + initialdir: StrOrBytesPath | None = None, + initialfile: StrOrBytesPath | None = None, + parent: Misc | None = None, + title: str | None = None, + typevariable: StringVar | str | None = None, ) -> str: ... # can be empty string def askopenfilename( *, 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 = ..., + filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] = (), + initialdir: StrOrBytesPath | None = None, + initialfile: StrOrBytesPath | None = None, + parent: Misc | None = None, + title: str | None = None, + typevariable: StringVar | str | None = None, ) -> str: ... # can be empty string def askopenfilenames( *, 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 = ..., + filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] = (), + initialdir: StrOrBytesPath | None = None, + initialfile: StrOrBytesPath | None = None, + parent: Misc | None = None, + title: str | None = None, + typevariable: StringVar | str | None = None, ) -> Literal[""] | tuple[str, ...]: ... def askdirectory( - *, initialdir: StrOrBytesPath | None = ..., mustexist: bool | None = False, parent: Misc | None = ..., title: str | None = ... + *, + initialdir: StrOrBytesPath | None = None, + mustexist: bool | None = False, + parent: Misc | None = None, + title: str | None = None, ) -> str: ... # can be empty string # TODO: If someone actually uses these, overload to have the actual return type of open(..., mode) @@ -117,33 +121,33 @@ def asksaveasfile( *, confirmoverwrite: bool | None = True, 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 = ..., + filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] = (), + initialdir: StrOrBytesPath | None = None, + initialfile: StrOrBytesPath | None = None, + parent: Misc | None = None, + title: str | None = None, + typevariable: StringVar | str | None = None, ) -> IO[Incomplete] | None: ... def askopenfile( mode: str = "r", *, 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 = ..., + filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] = (), + initialdir: StrOrBytesPath | None = None, + initialfile: StrOrBytesPath | None = None, + parent: Misc | None = None, + title: str | None = None, + typevariable: StringVar | str | None = None, ) -> IO[Incomplete] | None: ... def askopenfiles( mode: str = "r", *, 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 = ..., + filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] = (), + initialdir: StrOrBytesPath | None = None, + initialfile: StrOrBytesPath | None = None, + parent: Misc | None = None, + title: str | None = None, + typevariable: StringVar | str | None = None, ) -> tuple[IO[Incomplete], ...]: ... # can be empty tuple def test() -> None: ...