Delete a few simple type aliases in tkinter (#11415)

This commit is contained in:
Akuli
2024-02-13 12:37:32 +02:00
committed by GitHub
parent b44d22e81d
commit 41245698e0

View File

@@ -178,7 +178,6 @@ _Compound: TypeAlias = Literal["top", "left", "center", "right", "bottom", "none
_Cursor: TypeAlias = str | tuple[str] | tuple[str, str] | tuple[str, str, str] | tuple[str, str, str, str]
# example when it's sequence: entry['invalidcommand'] = [entry.register(print), '%P']
_EntryValidateCommand: TypeAlias = str | list[str] | tuple[str, ...] | Callable[[], bool]
_GridIndex: TypeAlias = int | str
_ImageSpec: TypeAlias = _Image | str # str can be from e.g. tkinter.image_names()
_Relief: TypeAlias = Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] # manual page: Tk_GetRelief
_ScreenUnits: TypeAlias = str | float # Often the right type instead of int. Manual page: Tk_GetPixels
@@ -262,16 +261,14 @@ class Event(Generic[_W_co]):
def NoDefaultRoot() -> None: ...
_TraceMode: TypeAlias = Literal["array", "read", "write", "unset"]
class Variable:
def __init__(self, master: Misc | None = None, value: Incomplete | None = None, name: str | None = None) -> None: ...
def set(self, value) -> None: ...
initialize = set
def get(self): ...
def trace_add(self, mode: _TraceMode, callback: Callable[[str, str, str], object]) -> str: ...
def trace_remove(self, mode: _TraceMode, cbname: str) -> None: ...
def trace_info(self) -> list[tuple[tuple[_TraceMode, ...], str]]: ...
def trace_add(self, mode: Literal["array", "read", "write", "unset"], callback: Callable[[str, str, str], object]) -> str: ...
def trace_remove(self, mode: Literal["array", "read", "write", "unset"], cbname: str) -> None: ...
def trace_info(self) -> list[tuple[tuple[Literal["array", "read", "write", "unset"], ...], str]]: ...
@deprecated("use trace_add() instead of trace()")
def trace(self, mode, callback): ...
@deprecated("use trace_add() instead of trace_variable()")
@@ -505,7 +502,7 @@ class Misc:
bbox = grid_bbox
def grid_columnconfigure(
self,
index: _GridIndex | list[int] | tuple[int, ...],
index: int | str | list[int] | tuple[int, ...],
cnf: _GridIndexInfo = {},
*,
minsize: _ScreenUnits = ...,
@@ -515,7 +512,7 @@ class Misc:
) -> _GridIndexInfo | Any: ... # can be None but annoying to check
def grid_rowconfigure(
self,
index: _GridIndex | list[int] | tuple[int, ...],
index: int | str | list[int] | tuple[int, ...],
cnf: _GridIndexInfo = {},
*,
minsize: _ScreenUnits = ...,
@@ -1851,8 +1848,6 @@ class Checkbutton(Widget):
def select(self) -> None: ...
def toggle(self) -> None: ...
_EntryIndex: TypeAlias = str | int # "INDICES" in manual page
class Entry(Widget, XView):
def __init__(
self,
@@ -1944,19 +1939,19 @@ class Entry(Widget, XView):
@overload
def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
config = configure
def delete(self, first: _EntryIndex, last: _EntryIndex | None = None) -> None: ...
def delete(self, first: str | int, last: str | int | None = None) -> None: ...
def get(self) -> str: ...
def icursor(self, index: _EntryIndex) -> None: ...
def index(self, index: _EntryIndex) -> int: ...
def insert(self, index: _EntryIndex, string: str) -> None: ...
def icursor(self, index: str | int) -> None: ...
def index(self, index: str | int) -> int: ...
def insert(self, index: str | int, string: str) -> None: ...
def scan_mark(self, x) -> None: ...
def scan_dragto(self, x) -> None: ...
def selection_adjust(self, index: _EntryIndex) -> None: ...
def selection_adjust(self, index: str | int) -> None: ...
def selection_clear(self) -> None: ... # type: ignore[override]
def selection_from(self, index: _EntryIndex) -> None: ...
def selection_from(self, index: str | int) -> None: ...
def selection_present(self) -> bool: ...
def selection_range(self, start: _EntryIndex, end: _EntryIndex) -> None: ...
def selection_to(self, index: _EntryIndex) -> None: ...
def selection_range(self, start: str | int, end: str | int) -> None: ...
def selection_to(self, index: str | int) -> None: ...
select_adjust = selection_adjust
select_clear = selection_clear
select_from = selection_from
@@ -3481,8 +3476,8 @@ class Spinbox(Widget, XView):
def get(self) -> str: ...
def icursor(self, index): ...
def identify(self, x: int, y: int) -> Literal["", "buttondown", "buttonup", "entry"]: ...
def index(self, index: _EntryIndex) -> int: ...
def insert(self, index: _EntryIndex, s: str) -> Literal[""]: ...
def index(self, index: str | int) -> int: ...
def insert(self, index: str | int, s: str) -> Literal[""]: ...
# spinbox.invoke("asdf") gives error mentioning .invoke("none"), but it's not documented
def invoke(self, element: Literal["none", "buttonup", "buttondown"]) -> Literal[""]: ...
def scan(self, *args): ...