Skip to content

Improve some of the incomplete types in tkinter.filedialog #14311

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 6 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions stdlib/tkinter/filedialog.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from _typeshed import Incomplete, StrOrBytesPath
from collections.abc import Iterable
from tkinter import Button, Entry, Frame, Listbox, Misc, Scrollbar, StringVar, Toplevel, commondialog
from _typeshed import Incomplete, StrOrBytesPath, StrPath
from collections.abc import Hashable, Iterable
from tkinter import Button, Entry, Event, Frame, Listbox, Misc, Scrollbar, StringVar, Toplevel, commondialog
from typing import IO, ClassVar, Literal

__all__ = [
Expand All @@ -19,12 +19,12 @@ __all__ = [
"askdirectory",
]

dialogstates: dict[Incomplete, tuple[Incomplete, Incomplete]]
dialogstates: dict[Hashable, tuple[str, str]]

class FileDialog:
title: str
master: Incomplete
directory: Incomplete | None
master: Misc
directory: str | None
top: Toplevel
botframe: Frame
selection: Entry
Expand All @@ -38,23 +38,23 @@ class FileDialog:
filter_button: Button
cancel_button: Button
def __init__(
self, master, title=None
self, master: Misc, title: str | None = None
) -> None: ... # title is usually a str or None, but e.g. int doesn't raise en exception either
how: Incomplete | None
def go(self, dir_or_file=".", pattern: str = "*", default: str = "", key=None): ...
def quit(self, how=None) -> None: ...
def dirs_double_event(self, event) -> None: ...
def dirs_select_event(self, event) -> None: ...
def files_double_event(self, event) -> None: ...
def files_select_event(self, event) -> None: ...
def ok_event(self, event) -> None: ...
how: str | None
def go(self, dir_or_file: StrPath = ".", pattern: StrPath = "*", default: StrPath = "", key: Hashable | None = None): ...
def quit(self, how: str | None = None) -> None: ...
def dirs_double_event(self, event: Event) -> None: ...
def dirs_select_event(self, event: Event) -> None: ...
def files_double_event(self, event: Event) -> None: ...
def files_select_event(self, event: Event) -> None: ...
def ok_event(self, event: Event) -> None: ...
def ok_command(self) -> None: ...
def filter_command(self, event=None) -> None: ...
def get_filter(self): ...
def get_selection(self): ...
def cancel_command(self, event=None) -> None: ...
def set_filter(self, dir, pat) -> None: ...
def set_selection(self, file) -> None: ...
def filter_command(self, event: Event | None = None) -> None: ...
def get_filter(self) -> tuple[str, str]: ...
def get_selection(self) -> str: ...
def cancel_command(self, event: Event | None = None) -> None: ...
def set_filter(self, dir: StrPath, pat: StrPath) -> None: ...
def set_selection(self, file: StrPath) -> None: ...

class LoadFileDialog(FileDialog):
title: str
Expand Down