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

This commit is contained in:
Marcell Perger
2025-06-23 07:32:29 +01:00
committed by GitHub
parent 85b0663e5c
commit 97d0c89618
+21 -21
View File
@@ -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__ = [
@@ -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
@@ -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