From f0c47cc6ccc4acd8a11c42da0e9116ed9da40145 Mon Sep 17 00:00:00 2001 From: donBarbos Date: Wed, 17 Sep 2025 20:01:18 +0400 Subject: [PATCH 1/4] [tkinter] Remove few type aliases Inspired by https://github.com/python/typeshed/pull/14631#discussion_r2296643547 I only got rid of some of the aliases (the simplest ones) to make sure that others supported this action and to test the functionality of this idea. --- stdlib/tkinter/__init__.pyi | 1301 +++++++++++------------ stdlib/tkinter/ttk.pyi | 307 +++--- stubs/ttkthemes/ttkthemes/themed_tk.pyi | 43 +- 3 files changed, 819 insertions(+), 832 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 54dd70baf199..69b9ccaec4e3 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -173,21 +173,8 @@ EXCEPTION: Final = _tkinter.EXCEPTION # # You can also read the manual pages online: https://www.tcl.tk/doc/ -# Some widgets have an option named -compound that accepts different values -# than the _Compound defined here. Many other options have similar things. -_Anchor: TypeAlias = Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] # manual page: Tk_GetAnchor -_ButtonCommand: TypeAlias = str | Callable[[], Any] # accepts string of tcl code, return value is returned from Button.invoke() -_Compound: TypeAlias = Literal["top", "left", "center", "right", "bottom", "none"] # -compound in manual page named 'options' # manual page: Tk_GetCursor _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] -_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 -# -xscrollcommand and -yscrollcommand in 'options' manual page -_XYScrollCommand: TypeAlias = str | Callable[[float, float], object] -_TakeFocusValue: TypeAlias = bool | Literal[0, 1, ""] | Callable[[str], bool | None] # -takefocus in manual page named 'options' if sys.version_info >= (3, 11): @type_check_only @@ -379,8 +366,8 @@ _Ts = TypeVarTuple("_Ts") @type_check_only class _GridIndexInfo(TypedDict, total=False): - minsize: _ScreenUnits - pad: _ScreenUnits + minsize: str | float + pad: str | float uniform: str | None weight: int @@ -479,7 +466,7 @@ class Misc: def winfo_containing(self, rootX: int, rootY: int, displayof: Literal[0] | Misc | None = 0) -> Misc | None: ... def winfo_depth(self) -> int: ... def winfo_exists(self) -> bool: ... - def winfo_fpixels(self, number: _ScreenUnits) -> float: ... + def winfo_fpixels(self, number: str | float) -> float: ... def winfo_geometry(self) -> str: ... def winfo_height(self) -> int: ... def winfo_id(self) -> int: ... @@ -489,7 +476,7 @@ class Misc: def winfo_name(self) -> str: ... def winfo_parent(self) -> str: ... # return value needs nametowidget() def winfo_pathname(self, id: int, displayof: Literal[0] | Misc | None = 0): ... - def winfo_pixels(self, number: _ScreenUnits) -> int: ... + def winfo_pixels(self, number: str | float) -> int: ... def winfo_pointerx(self) -> int: ... def winfo_pointerxy(self) -> tuple[int, int]: ... def winfo_pointery(self) -> int: ... @@ -580,7 +567,7 @@ class Misc: @overload def pack_propagate(self) -> None: ... propagate = pack_propagate - def grid_anchor(self, anchor: _Anchor | None = None) -> None: ... + def grid_anchor(self, anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] | None = None) -> None: ... anchor = grid_anchor @overload def grid_bbox( @@ -596,8 +583,8 @@ class Misc: index: int | str | list[int] | tuple[int, ...], cnf: _GridIndexInfo = {}, *, - minsize: _ScreenUnits = ..., - pad: _ScreenUnits = ..., + minsize: str | float = ..., + pad: str | float = ..., uniform: str = ..., weight: int = ..., ) -> _GridIndexInfo | MaybeNone: ... # can be None but annoying to check @@ -606,14 +593,14 @@ class Misc: index: int | str | list[int] | tuple[int, ...], cnf: _GridIndexInfo = {}, *, - minsize: _ScreenUnits = ..., - pad: _ScreenUnits = ..., + minsize: str | float = ..., + pad: str | float = ..., uniform: str = ..., weight: int = ..., ) -> _GridIndexInfo | MaybeNone: ... # can be None but annoying to check columnconfigure = grid_columnconfigure rowconfigure = grid_rowconfigure - def grid_location(self, x: _ScreenUnits, y: _ScreenUnits) -> tuple[int, int]: ... + def grid_location(self, x: str | float, y: str | float) -> tuple[int, int]: ... @overload def grid_propagate(self, flag: bool) -> None: ... @overload @@ -632,32 +619,32 @@ class Misc: sequence: str, *, above: Misc | int = ..., - borderwidth: _ScreenUnits = ..., + borderwidth: str | float = ..., button: int = ..., count: int = ..., data: Any = ..., # anything with usable str() value delta: int = ..., detail: str = ..., focus: bool = ..., - height: _ScreenUnits = ..., + height: str | float = ..., keycode: int = ..., keysym: str = ..., mode: str = ..., override: bool = ..., place: Literal["PlaceOnTop", "PlaceOnBottom"] = ..., root: Misc | int = ..., - rootx: _ScreenUnits = ..., - rooty: _ScreenUnits = ..., + rootx: str | float = ..., + rooty: str | float = ..., sendevent: bool = ..., serial: int = ..., state: int | str = ..., subwindow: Misc | int = ..., time: int = ..., warp: bool = ..., - width: _ScreenUnits = ..., + width: str | float = ..., when: Literal["now", "tail", "head", "mark"] = ..., - x: _ScreenUnits = ..., - y: _ScreenUnits = ..., + x: str | float = ..., + y: str | float = ..., ) -> None: ... def event_info(self, virtual: str | None = None) -> tuple[str, ...]: ... def image_names(self) -> tuple[str, ...]: ... @@ -686,7 +673,7 @@ class XView: @overload def xview_scroll(self, number: int, what: Literal["units", "pages"]) -> None: ... @overload - def xview_scroll(self, number: _ScreenUnits, what: Literal["pixels"]) -> None: ... + def xview_scroll(self, number: str | float, what: Literal["pixels"]) -> None: ... class YView: @overload @@ -697,7 +684,7 @@ class YView: @overload def yview_scroll(self, number: int, what: Literal["units", "pages"]) -> None: ... @overload - def yview_scroll(self, number: _ScreenUnits, what: Literal["pixels"]) -> None: ... + def yview_scroll(self, number: str | float, what: Literal["pixels"]) -> None: ... if sys.platform == "darwin": @type_check_only @@ -993,21 +980,21 @@ class Tk(Misc, Wm): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., cursor: _Cursor = ..., - height: _ScreenUnits = ..., + height: str | float = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = ..., + highlightthickness: str | float = ..., menu: Menu = ..., - padx: _ScreenUnits = ..., - pady: _ScreenUnits = ..., - relief: _Relief = ..., - takefocus: _TakeFocusValue = ..., - width: _ScreenUnits = ..., + padx: str | float = ..., + pady: str | float = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., + width: str | float = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -1056,11 +1043,11 @@ _InMiscNonTotal = TypedDict("_InMiscNonTotal", {"in": Misc}, total=False) @type_check_only class _PackInfo(_InMiscTotal): # 'before' and 'after' never appear in _PackInfo - anchor: _Anchor + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] expand: bool fill: Literal["none", "x", "y", "both"] side: Literal["left", "right", "top", "bottom"] - # Paddings come out as int or tuple of int, even though any _ScreenUnits + # Paddings come out as int or tuple of int, even though any str or float # can be specified in pack(). ipadx: int ipady: int @@ -1069,7 +1056,7 @@ class _PackInfo(_InMiscTotal): class Pack: # _PackInfo is not the valid type for cnf because pad stuff accepts any - # _ScreenUnits instead of int only. I didn't bother to create another + # str or float instead of int only. I didn't bother to create another # TypedDict for cnf because it appears to be a legacy thing that was # replaced by **kwargs. def pack_configure( @@ -1077,15 +1064,15 @@ class Pack: cnf: Mapping[str, Any] | None = {}, *, after: Misc = ..., - anchor: _Anchor = ..., + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., before: Misc = ..., expand: bool | Literal[0, 1] = 0, fill: Literal["none", "x", "y", "both"] = ..., side: Literal["left", "right", "top", "bottom"] = ..., - ipadx: _ScreenUnits = ..., - ipady: _ScreenUnits = ..., - padx: _ScreenUnits | tuple[_ScreenUnits, _ScreenUnits] = ..., - pady: _ScreenUnits | tuple[_ScreenUnits, _ScreenUnits] = ..., + ipadx: str | float = ..., + ipady: str | float = ..., + padx: str | float | tuple[str | float, str | float] = ..., + pady: str | float | tuple[str | float, str | float] = ..., in_: Misc = ..., **kw: Any, # allow keyword argument named 'in', see #4836 ) -> None: ... @@ -1097,7 +1084,7 @@ class Pack: @type_check_only class _PlaceInfo(_InMiscNonTotal): # empty dict if widget hasn't been placed - anchor: _Anchor + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] bordermode: Literal["inside", "outside", "ignore"] width: str # can be int()ed (even after e.g. widget.place(height='2.3c') or similar) height: str # can be int()ed @@ -1113,12 +1100,12 @@ class Place: self, cnf: Mapping[str, Any] | None = {}, *, - anchor: _Anchor = ..., + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., bordermode: Literal["inside", "outside", "ignore"] = ..., - width: _ScreenUnits = ..., - height: _ScreenUnits = ..., - x: _ScreenUnits = ..., - y: _ScreenUnits = ..., + width: str | float = ..., + height: str | float = ..., + x: str | float = ..., + y: str | float = ..., # str allowed for compatibility with place_info() relheight: str | float = ..., relwidth: str | float = ..., @@ -1153,10 +1140,10 @@ class Grid: columnspan: int = ..., row: int = ..., rowspan: int = ..., - ipadx: _ScreenUnits = ..., - ipady: _ScreenUnits = ..., - padx: _ScreenUnits | tuple[_ScreenUnits, _ScreenUnits] = ..., - pady: _ScreenUnits | tuple[_ScreenUnits, _ScreenUnits] = ..., + ipadx: str | float = ..., + ipady: str | float = ..., + padx: str | float | tuple[str | float, str | float] = ..., + pady: str | float | tuple[str | float, str | float] = ..., sticky: str = ..., # consists of letters 'n', 's', 'w', 'e', may contain repeats, may be empty in_: Misc = ..., **kw: Any, # allow keyword argument named 'in', see #4836 @@ -1201,28 +1188,28 @@ class Toplevel(BaseWidget, Wm): cnf: dict[str, Any] | None = {}, *, background: str = ..., - bd: _ScreenUnits = 0, + bd: str | float = 0, bg: str = ..., - border: _ScreenUnits = 0, - borderwidth: _ScreenUnits = 0, + border: str | float = 0, + borderwidth: str | float = 0, class_: str = "Toplevel", colormap: Literal["new", ""] | Misc = "", container: bool = False, cursor: _Cursor = "", - height: _ScreenUnits = 0, + height: str | float = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = 0, + highlightthickness: str | float = 0, menu: Menu = ..., name: str = ..., - padx: _ScreenUnits = 0, - pady: _ScreenUnits = 0, - relief: _Relief = "flat", + padx: str | float = 0, + pady: str | float = 0, + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", screen: str = "", # can't be changed after creating widget - takefocus: _TakeFocusValue = 0, + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = 0, use: int = ..., visual: str | tuple[str, int] = "", - width: _ScreenUnits = 0, + width: str | float = 0, ) -> None: ... @overload def configure( @@ -1230,21 +1217,21 @@ class Toplevel(BaseWidget, Wm): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., cursor: _Cursor = ..., - height: _ScreenUnits = ..., + height: str | float = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = ..., + highlightthickness: str | float = ..., menu: Menu = ..., - padx: _ScreenUnits = ..., - pady: _ScreenUnits = ..., - relief: _Relief = ..., - takefocus: _TakeFocusValue = ..., - width: _ScreenUnits = ..., + padx: str | float = ..., + pady: str | float = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., + width: str | float = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -1258,15 +1245,15 @@ class Button(Widget): *, activebackground: str = ..., activeforeground: str = ..., - anchor: _Anchor = "center", + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = "center", background: str = ..., - bd: _ScreenUnits = ..., # same as borderwidth + bd: str | float = ..., # same as borderwidth bg: str = ..., # same as background bitmap: str = "", - border: _ScreenUnits = ..., # same as borderwidth - borderwidth: _ScreenUnits = ..., - command: _ButtonCommand = "", - compound: _Compound = "none", + border: str | float = ..., # same as borderwidth + borderwidth: str | float = ..., + command: str | Callable[[], Any] = "", + compound: Literal["top", "left", "center", "right", "bottom", "none"] = "none", cursor: _Cursor = "", default: Literal["normal", "active", "disabled"] = "disabled", disabledforeground: str = ..., @@ -1274,30 +1261,30 @@ class Button(Widget): font: _FontDescription = "TkDefaultFont", foreground: str = ..., # width and height must be int for buttons containing just text, but - # ints are also valid _ScreenUnits - height: _ScreenUnits = 0, + # ints are also valid ScreenUnits is str or float + height: str | float = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = 1, - image: _ImageSpec = "", + highlightthickness: str | float = 1, + image: _Image | str = "", justify: Literal["left", "center", "right"] = "center", name: str = ..., - overrelief: _Relief | Literal[""] = "", - padx: _ScreenUnits = ..., - pady: _ScreenUnits = ..., - relief: _Relief = ..., + overrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove", ""] = "", + padx: str | float = ..., + pady: str | float = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., repeatdelay: int = ..., repeatinterval: int = ..., state: Literal["normal", "active", "disabled"] = "normal", - takefocus: _TakeFocusValue = "", + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", text: float | str = "", # We allow the textvariable to be any Variable, not necessarily # StringVar. This is useful for e.g. a button that displays the value # of an IntVar. textvariable: Variable = ..., underline: int = -1, - width: _ScreenUnits = 0, - wraplength: _ScreenUnits = 0, + width: str | float = 0, + wraplength: str | float = 0, ) -> None: ... @overload def configure( @@ -1306,40 +1293,40 @@ class Button(Widget): *, activebackground: str = ..., activeforeground: str = ..., - anchor: _Anchor = ..., + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., bitmap: str = ..., - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., - command: _ButtonCommand = ..., - compound: _Compound = ..., + border: str | float = ..., + borderwidth: str | float = ..., + command: str | Callable[[], Any] = ..., + compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., cursor: _Cursor = ..., default: Literal["normal", "active", "disabled"] = ..., disabledforeground: str = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: _ScreenUnits = ..., + height: str | float = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = ..., - image: _ImageSpec = ..., + highlightthickness: str | float = ..., + image: _Image | str = ..., justify: Literal["left", "center", "right"] = ..., - overrelief: _Relief | Literal[""] = ..., - padx: _ScreenUnits = ..., - pady: _ScreenUnits = ..., - relief: _Relief = ..., + overrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove", ""] = ..., + padx: str | float = ..., + pady: str | float = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., repeatdelay: int = ..., repeatinterval: int = ..., state: Literal["normal", "active", "disabled"] = ..., - takefocus: _TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = ..., textvariable: Variable = ..., underline: int = ..., - width: _ScreenUnits = ..., - wraplength: _ScreenUnits = ..., + width: str | float = ..., + wraplength: str | float = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -1354,41 +1341,41 @@ class Canvas(Widget, XView, YView): cnf: dict[str, Any] | None = {}, *, background: str = ..., - bd: _ScreenUnits = 0, + bd: str | float = 0, bg: str = ..., - border: _ScreenUnits = 0, - borderwidth: _ScreenUnits = 0, + border: str | float = 0, + borderwidth: str | float = 0, closeenough: float = 1.0, confine: bool = True, cursor: _Cursor = "", # canvas manual page has a section named COORDINATES, and the first - # part of it describes _ScreenUnits. - height: _ScreenUnits = ..., + # part of it describes str or float type. + height: str | float = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = ..., + highlightthickness: str | float = ..., insertbackground: str = ..., - insertborderwidth: _ScreenUnits = 0, + insertborderwidth: str | float = 0, insertofftime: int = 300, insertontime: int = 600, - insertwidth: _ScreenUnits = 2, + insertwidth: str | float = 2, name: str = ..., offset=..., # undocumented - relief: _Relief = "flat", + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", # Setting scrollregion to None doesn't reset it back to empty, # but setting it to () does. - scrollregion: tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits] | tuple[()] = (), + scrollregion: tuple[str | float, str | float, str | float, str | float] | tuple[()] = (), selectbackground: str = ..., - selectborderwidth: _ScreenUnits = 1, + selectborderwidth: str | float = 1, selectforeground: str = ..., # man page says that state can be 'hidden', but it can't state: Literal["normal", "disabled"] = "normal", - takefocus: _TakeFocusValue = "", - width: _ScreenUnits = ..., - xscrollcommand: _XYScrollCommand = "", - xscrollincrement: _ScreenUnits = 0, - yscrollcommand: _XYScrollCommand = "", - yscrollincrement: _ScreenUnits = 0, + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", + width: str | float = ..., + xscrollcommand: str | Callable[[float, float], object] = "", + xscrollincrement: str | float = 0, + yscrollcommand: str | Callable[[float, float], object] = "", + yscrollincrement: str | float = 0, ) -> None: ... @overload def configure( @@ -1396,35 +1383,35 @@ class Canvas(Widget, XView, YView): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., closeenough: float = ..., confine: bool = ..., cursor: _Cursor = ..., - height: _ScreenUnits = ..., + height: str | float = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = ..., + highlightthickness: str | float = ..., insertbackground: str = ..., - insertborderwidth: _ScreenUnits = ..., + insertborderwidth: str | float = ..., insertofftime: int = ..., insertontime: int = ..., - insertwidth: _ScreenUnits = ..., + insertwidth: str | float = ..., offset=..., # undocumented - relief: _Relief = ..., - scrollregion: tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits] | tuple[()] = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + scrollregion: tuple[str | float, str | float, str | float, str | float] | tuple[()] = ..., selectbackground: str = ..., - selectborderwidth: _ScreenUnits = ..., + selectborderwidth: str | float = ..., selectforeground: str = ..., state: Literal["normal", "disabled"] = ..., - takefocus: _TakeFocusValue = ..., - width: _ScreenUnits = ..., - xscrollcommand: _XYScrollCommand = ..., - xscrollincrement: _ScreenUnits = ..., - yscrollcommand: _XYScrollCommand = ..., - yscrollincrement: _ScreenUnits = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., + width: str | float = ..., + xscrollcommand: str | Callable[[float, float], object] = ..., + xscrollincrement: str | float = ..., + yscrollcommand: str | Callable[[float, float], object] = ..., + yscrollincrement: str | float = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -1434,20 +1421,20 @@ class Canvas(Widget, XView, YView): def addtag_all(self, newtag: str) -> None: ... def addtag_below(self, newtag: str, tagOrId: str | int) -> None: ... def addtag_closest( - self, newtag: str, x: _ScreenUnits, y: _ScreenUnits, halo: _ScreenUnits | None = None, start: str | int | None = None + self, newtag: str, x: str | float, y: str | float, halo: str | float | None = None, start: str | int | None = None ) -> None: ... - def addtag_enclosed(self, newtag: str, x1: _ScreenUnits, y1: _ScreenUnits, x2: _ScreenUnits, y2: _ScreenUnits) -> None: ... - def addtag_overlapping(self, newtag: str, x1: _ScreenUnits, y1: _ScreenUnits, x2: _ScreenUnits, y2: _ScreenUnits) -> None: ... + def addtag_enclosed(self, newtag: str, x1: str | float, y1: str | float, x2: str | float, y2: str | float) -> None: ... + def addtag_overlapping(self, newtag: str, x1: str | float, y1: str | float, x2: str | float, y2: str | float) -> None: ... def addtag_withtag(self, newtag: str, tagOrId: str | int) -> None: ... def find(self, *args): ... # internal method def find_above(self, tagOrId: str | int) -> tuple[int, ...]: ... def find_all(self) -> tuple[int, ...]: ... def find_below(self, tagOrId: str | int) -> tuple[int, ...]: ... def find_closest( - self, x: _ScreenUnits, y: _ScreenUnits, halo: _ScreenUnits | None = None, start: str | int | None = None + self, x: str | float, y: str | float, halo: str | float | None = None, start: str | int | None = None ) -> tuple[int, ...]: ... - def find_enclosed(self, x1: _ScreenUnits, y1: _ScreenUnits, x2: _ScreenUnits, y2: _ScreenUnits) -> tuple[int, ...]: ... - def find_overlapping(self, x1: _ScreenUnits, y1: _ScreenUnits, x2: _ScreenUnits, y2: float) -> tuple[int, ...]: ... + def find_enclosed(self, x1: str | float, y1: str | float, x2: str | float, y2: str | float) -> tuple[int, ...]: ... + def find_overlapping(self, x1: str | float, y1: str | float, x2: str | float, y2: float) -> tuple[int, ...]: ... def find_withtag(self, tagOrId: str | int) -> tuple[int, ...]: ... # Incompatible with Misc.bbox(), tkinter violates LSP def bbox(self, *args: str | int) -> tuple[int, int, int, int]: ... # type: ignore[override] @@ -1492,25 +1479,25 @@ class Canvas(Widget, XView, YView): activedash: str | int | list[int] | tuple[int, ...] = ..., activefill: str = ..., activestipple: str = ..., - activewidth: _ScreenUnits = ..., + activewidth: str | float = ..., arrow: Literal["first", "last", "both"] = ..., arrowshape: tuple[float, float, float] = ..., capstyle: Literal["round", "projecting", "butt"] = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: _ScreenUnits = ..., + dashoffset: str | float = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledstipple: str = ..., - disabledwidth: _ScreenUnits = ..., + disabledwidth: str | float = ..., fill: str = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: _ScreenUnits = ..., + offset: str | float = ..., smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: _ScreenUnits = ..., + width: str | float = ..., ) -> int: ... @overload def create_line( @@ -1522,25 +1509,25 @@ class Canvas(Widget, XView, YView): activedash: str | int | list[int] | tuple[int, ...] = ..., activefill: str = ..., activestipple: str = ..., - activewidth: _ScreenUnits = ..., + activewidth: str | float = ..., arrow: Literal["first", "last", "both"] = ..., arrowshape: tuple[float, float, float] = ..., capstyle: Literal["round", "projecting", "butt"] = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: _ScreenUnits = ..., + dashoffset: str | float = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledstipple: str = ..., - disabledwidth: _ScreenUnits = ..., + disabledwidth: str | float = ..., fill: str = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: _ScreenUnits = ..., + offset: str | float = ..., smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: _ScreenUnits = ..., + width: str | float = ..., ) -> int: ... @overload def create_line( @@ -1558,25 +1545,25 @@ class Canvas(Widget, XView, YView): activedash: str | int | list[int] | tuple[int, ...] = ..., activefill: str = ..., activestipple: str = ..., - activewidth: _ScreenUnits = ..., + activewidth: str | float = ..., arrow: Literal["first", "last", "both"] = ..., arrowshape: tuple[float, float, float] = ..., capstyle: Literal["round", "projecting", "butt"] = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: _ScreenUnits = ..., + dashoffset: str | float = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledstipple: str = ..., - disabledwidth: _ScreenUnits = ..., + disabledwidth: str | float = ..., fill: str = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: _ScreenUnits = ..., + offset: str | float = ..., smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: _ScreenUnits = ..., + width: str | float = ..., ) -> int: ... @overload def create_oval( @@ -1592,24 +1579,24 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: _ScreenUnits = ..., + activewidth: str | float = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: _ScreenUnits = ..., + dashoffset: str | float = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: _ScreenUnits = ..., + disabledwidth: str | float = ..., fill: str = ..., - offset: _ScreenUnits = ..., + offset: str | float = ..., outline: str = ..., - outlineoffset: _ScreenUnits = ..., + outlineoffset: str | float = ..., outlinestipple: str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: _ScreenUnits = ..., + width: str | float = ..., ) -> int: ... @overload def create_oval( @@ -1623,24 +1610,24 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: _ScreenUnits = ..., + activewidth: str | float = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: _ScreenUnits = ..., + dashoffset: str | float = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: _ScreenUnits = ..., + disabledwidth: str | float = ..., fill: str = ..., - offset: _ScreenUnits = ..., + offset: str | float = ..., outline: str = ..., - outlineoffset: _ScreenUnits = ..., + outlineoffset: str | float = ..., outlinestipple: str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: _ScreenUnits = ..., + width: str | float = ..., ) -> int: ... @overload def create_oval( @@ -1660,24 +1647,24 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: _ScreenUnits = ..., + activewidth: str | float = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: _ScreenUnits = ..., + dashoffset: str | float = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: _ScreenUnits = ..., + disabledwidth: str | float = ..., fill: str = ..., - offset: _ScreenUnits = ..., + offset: str | float = ..., outline: str = ..., - outlineoffset: _ScreenUnits = ..., + outlineoffset: str | float = ..., outlinestipple: str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: _ScreenUnits = ..., + width: str | float = ..., ) -> int: ... @overload def create_polygon( @@ -1693,27 +1680,27 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: _ScreenUnits = ..., + activewidth: str | float = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: _ScreenUnits = ..., + dashoffset: str | float = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: _ScreenUnits = ..., + disabledwidth: str | float = ..., fill: str = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: _ScreenUnits = ..., + offset: str | float = ..., outline: str = ..., - outlineoffset: _ScreenUnits = ..., + outlineoffset: str | float = ..., outlinestipple: str = ..., smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: _ScreenUnits = ..., + width: str | float = ..., ) -> int: ... @overload def create_polygon( @@ -1727,27 +1714,27 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: _ScreenUnits = ..., + activewidth: str | float = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: _ScreenUnits = ..., + dashoffset: str | float = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: _ScreenUnits = ..., + disabledwidth: str | float = ..., fill: str = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: _ScreenUnits = ..., + offset: str | float = ..., outline: str = ..., - outlineoffset: _ScreenUnits = ..., + outlineoffset: str | float = ..., outlinestipple: str = ..., smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: _ScreenUnits = ..., + width: str | float = ..., ) -> int: ... @overload def create_polygon( @@ -1767,27 +1754,27 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: _ScreenUnits = ..., + activewidth: str | float = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: _ScreenUnits = ..., + dashoffset: str | float = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: _ScreenUnits = ..., + disabledwidth: str | float = ..., fill: str = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: _ScreenUnits = ..., + offset: str | float = ..., outline: str = ..., - outlineoffset: _ScreenUnits = ..., + outlineoffset: str | float = ..., outlinestipple: str = ..., smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: _ScreenUnits = ..., + width: str | float = ..., ) -> int: ... @overload def create_rectangle( @@ -1803,24 +1790,24 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: _ScreenUnits = ..., + activewidth: str | float = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: _ScreenUnits = ..., + dashoffset: str | float = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: _ScreenUnits = ..., + disabledwidth: str | float = ..., fill: str = ..., - offset: _ScreenUnits = ..., + offset: str | float = ..., outline: str = ..., - outlineoffset: _ScreenUnits = ..., + outlineoffset: str | float = ..., outlinestipple: str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: _ScreenUnits = ..., + width: str | float = ..., ) -> int: ... @overload def create_rectangle( @@ -1834,24 +1821,24 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: _ScreenUnits = ..., + activewidth: str | float = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: _ScreenUnits = ..., + dashoffset: str | float = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: _ScreenUnits = ..., + disabledwidth: str | float = ..., fill: str = ..., - offset: _ScreenUnits = ..., + offset: str | float = ..., outline: str = ..., - outlineoffset: _ScreenUnits = ..., + outlineoffset: str | float = ..., outlinestipple: str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: _ScreenUnits = ..., + width: str | float = ..., ) -> int: ... @overload def create_rectangle( @@ -1871,24 +1858,24 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: _ScreenUnits = ..., + activewidth: str | float = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: _ScreenUnits = ..., + dashoffset: str | float = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: _ScreenUnits = ..., + disabledwidth: str | float = ..., fill: str = ..., - offset: _ScreenUnits = ..., + offset: str | float = ..., outline: str = ..., - outlineoffset: _ScreenUnits = ..., + outlineoffset: str | float = ..., outlinestipple: str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: _ScreenUnits = ..., + width: str | float = ..., ) -> int: ... @overload def create_text( @@ -1899,19 +1886,19 @@ class Canvas(Widget, XView, YView): *, activefill: str = ..., activestipple: str = ..., - anchor: _Anchor = ..., + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., angle: float | str = ..., disabledfill: str = ..., disabledstipple: str = ..., fill: str = ..., font: _FontDescription = ..., justify: Literal["left", "center", "right"] = ..., - offset: _ScreenUnits = ..., + offset: str | float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., text: float | str = ..., - width: _ScreenUnits = ..., + width: str | float = ..., ) -> int: ... @overload def create_text( @@ -1921,19 +1908,19 @@ class Canvas(Widget, XView, YView): *, activefill: str = ..., activestipple: str = ..., - anchor: _Anchor = ..., + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., angle: float | str = ..., disabledfill: str = ..., disabledstipple: str = ..., fill: str = ..., font: _FontDescription = ..., justify: Literal["left", "center", "right"] = ..., - offset: _ScreenUnits = ..., + offset: str | float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., text: float | str = ..., - width: _ScreenUnits = ..., + width: str | float = ..., ) -> int: ... @overload def create_window( @@ -1942,11 +1929,11 @@ class Canvas(Widget, XView, YView): y: float, /, *, - anchor: _Anchor = ..., - height: _ScreenUnits = ..., + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., + height: str | float = ..., state: Literal["normal", "hidden", "disabled"] = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: _ScreenUnits = ..., + width: str | float = ..., window: Widget = ..., ) -> int: ... @overload @@ -1955,11 +1942,11 @@ class Canvas(Widget, XView, YView): coords: tuple[float, float] | list[int] | list[float], /, *, - anchor: _Anchor = ..., - height: _ScreenUnits = ..., + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., + height: str | float = ..., state: Literal["normal", "hidden", "disabled"] = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: _ScreenUnits = ..., + width: str | float = ..., window: Widget = ..., ) -> int: ... def dchars(self, *args) -> None: ... @@ -1992,9 +1979,7 @@ class Canvas(Widget, XView, YView): def tag_raise(self, first: str | int, second: str | int | None = ..., /) -> None: ... def tkraise(self, first: str | int, second: str | int | None = ..., /) -> None: ... # type: ignore[override] def lift(self, first: str | int, second: str | int | None = ..., /) -> None: ... # type: ignore[override] - def scale( - self, tagOrId: str | int, xOrigin: _ScreenUnits, yOrigin: _ScreenUnits, xScale: float, yScale: float, / - ) -> None: ... + def scale(self, tagOrId: str | int, xOrigin: str | float, yOrigin: str | float, xScale: float, yScale: float, /) -> None: ... def scan_mark(self, x, y) -> None: ... def scan_dragto(self, x, y, gain: int = 10) -> None: ... def select_adjust(self, tagOrId, index) -> None: ... @@ -2012,29 +1997,29 @@ class Checkbutton(Widget): *, activebackground: str = ..., activeforeground: str = ..., - anchor: _Anchor = "center", + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = "center", background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., bitmap: str = "", - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., - command: _ButtonCommand = "", - compound: _Compound = "none", + border: str | float = ..., + borderwidth: str | float = ..., + command: str | Callable[[], Any] = "", + compound: Literal["top", "left", "center", "right", "bottom", "none"] = "none", cursor: _Cursor = "", disabledforeground: str = ..., fg: str = ..., font: _FontDescription = "TkDefaultFont", foreground: str = ..., - height: _ScreenUnits = 0, + height: str | float = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = 1, - image: _ImageSpec = "", + highlightthickness: str | float = 1, + image: _Image | str = "", indicatoron: bool = True, justify: Literal["left", "center", "right"] = "center", name: str = ..., - offrelief: _Relief = ..., + offrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., # The checkbutton puts a value to its variable when it's checked or # unchecked. We don't restrict the type of that value here, so # Any-typing is fine. @@ -2047,22 +2032,22 @@ class Checkbutton(Widget): # done by setting variable to empty string (the default). offvalue: Any = 0, onvalue: Any = 1, - overrelief: _Relief | Literal[""] = "", - padx: _ScreenUnits = 1, - pady: _ScreenUnits = 1, - relief: _Relief = "flat", + overrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove", ""] = "", + padx: str | float = 1, + pady: str | float = 1, + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", selectcolor: str = ..., - selectimage: _ImageSpec = "", + selectimage: _Image | str = "", state: Literal["normal", "active", "disabled"] = "normal", - takefocus: _TakeFocusValue = "", + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", text: float | str = "", textvariable: Variable = ..., - tristateimage: _ImageSpec = "", + tristateimage: _Image | str = "", tristatevalue: Any = "", underline: int = -1, variable: Variable | Literal[""] = ..., - width: _ScreenUnits = 0, - wraplength: _ScreenUnits = 0, + width: str | float = 0, + wraplength: str | float = 0, ) -> None: ... @overload def configure( @@ -2071,46 +2056,46 @@ class Checkbutton(Widget): *, activebackground: str = ..., activeforeground: str = ..., - anchor: _Anchor = ..., + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., bitmap: str = ..., - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., - command: _ButtonCommand = ..., - compound: _Compound = ..., + border: str | float = ..., + borderwidth: str | float = ..., + command: str | Callable[[], Any] = ..., + compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., cursor: _Cursor = ..., disabledforeground: str = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: _ScreenUnits = ..., + height: str | float = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = ..., - image: _ImageSpec = ..., + highlightthickness: str | float = ..., + image: _Image | str = ..., indicatoron: bool = ..., justify: Literal["left", "center", "right"] = ..., - offrelief: _Relief = ..., + offrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., offvalue: Any = ..., onvalue: Any = ..., - overrelief: _Relief | Literal[""] = ..., - padx: _ScreenUnits = ..., - pady: _ScreenUnits = ..., - relief: _Relief = ..., + overrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove", ""] = ..., + padx: str | float = ..., + pady: str | float = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., selectcolor: str = ..., - selectimage: _ImageSpec = ..., + selectimage: _Image | str = ..., state: Literal["normal", "active", "disabled"] = ..., - takefocus: _TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = ..., textvariable: Variable = ..., - tristateimage: _ImageSpec = ..., + tristateimage: _Image | str = ..., tristatevalue: Any = ..., underline: int = ..., variable: Variable | Literal[""] = ..., - width: _ScreenUnits = ..., - wraplength: _ScreenUnits = ..., + width: str | float = ..., + wraplength: str | float = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -2128,10 +2113,10 @@ class Entry(Widget, XView): cnf: dict[str, Any] | None = {}, *, background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., cursor: _Cursor = "xterm", disabledbackground: str = ..., disabledforeground: str = ..., @@ -2141,30 +2126,30 @@ class Entry(Widget, XView): foreground: str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = ..., + highlightthickness: str | float = ..., insertbackground: str = ..., - insertborderwidth: _ScreenUnits = 0, + insertborderwidth: str | float = 0, insertofftime: int = 300, insertontime: int = 600, - insertwidth: _ScreenUnits = ..., - invalidcommand: _EntryValidateCommand = "", - invcmd: _EntryValidateCommand = "", # same as invalidcommand + insertwidth: str | float = ..., + invalidcommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = "", + invcmd: str | list[str] | tuple[str, ...] | Callable[[], bool] = "", # same as invalidcommand justify: Literal["left", "center", "right"] = "left", name: str = ..., readonlybackground: str = ..., - relief: _Relief = "sunken", + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "sunken", selectbackground: str = ..., - selectborderwidth: _ScreenUnits = ..., + selectborderwidth: str | float = ..., selectforeground: str = ..., show: str = "", state: Literal["normal", "disabled", "readonly"] = "normal", - takefocus: _TakeFocusValue = "", + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", textvariable: Variable = ..., validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = "none", - validatecommand: _EntryValidateCommand = "", - vcmd: _EntryValidateCommand = "", # same as validatecommand + validatecommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = "", + vcmd: str | list[str] | tuple[str, ...] | Callable[[], bool] = "", # same as validatecommand width: int = 20, - xscrollcommand: _XYScrollCommand = "", + xscrollcommand: str | Callable[[float, float], object] = "", ) -> None: ... @overload def configure( @@ -2172,10 +2157,10 @@ class Entry(Widget, XView): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., cursor: _Cursor = ..., disabledbackground: str = ..., disabledforeground: str = ..., @@ -2185,29 +2170,29 @@ class Entry(Widget, XView): foreground: str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = ..., + highlightthickness: str | float = ..., insertbackground: str = ..., - insertborderwidth: _ScreenUnits = ..., + insertborderwidth: str | float = ..., insertofftime: int = ..., insertontime: int = ..., - insertwidth: _ScreenUnits = ..., - invalidcommand: _EntryValidateCommand = ..., - invcmd: _EntryValidateCommand = ..., + insertwidth: str | float = ..., + invalidcommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., + invcmd: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., justify: Literal["left", "center", "right"] = ..., readonlybackground: str = ..., - relief: _Relief = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., selectbackground: str = ..., - selectborderwidth: _ScreenUnits = ..., + selectborderwidth: str | float = ..., selectforeground: str = ..., show: str = ..., state: Literal["normal", "disabled", "readonly"] = ..., - takefocus: _TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., textvariable: Variable = ..., validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ..., - validatecommand: _EntryValidateCommand = ..., - vcmd: _EntryValidateCommand = ..., + validatecommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., + vcmd: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., width: int = ..., - xscrollcommand: _XYScrollCommand = ..., + xscrollcommand: str | Callable[[float, float], object] = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -2239,25 +2224,25 @@ class Frame(Widget): cnf: dict[str, Any] | None = {}, *, background: str = ..., - bd: _ScreenUnits = 0, + bd: str | float = 0, bg: str = ..., - border: _ScreenUnits = 0, - borderwidth: _ScreenUnits = 0, + border: str | float = 0, + borderwidth: str | float = 0, class_: str = "Frame", # can't be changed with configure() colormap: Literal["new", ""] | Misc = "", # can't be changed with configure() container: bool = False, # can't be changed with configure() cursor: _Cursor = "", - height: _ScreenUnits = 0, + height: str | float = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = 0, + highlightthickness: str | float = 0, name: str = ..., - padx: _ScreenUnits = 0, - pady: _ScreenUnits = 0, - relief: _Relief = "flat", - takefocus: _TakeFocusValue = 0, + padx: str | float = 0, + pady: str | float = 0, + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = 0, visual: str | tuple[str, int] = "", # can't be changed with configure() - width: _ScreenUnits = 0, + width: str | float = 0, ) -> None: ... @overload def configure( @@ -2265,20 +2250,20 @@ class Frame(Widget): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., cursor: _Cursor = ..., - height: _ScreenUnits = ..., + height: str | float = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = ..., - padx: _ScreenUnits = ..., - pady: _ScreenUnits = ..., - relief: _Relief = ..., - takefocus: _TakeFocusValue = ..., - width: _ScreenUnits = ..., + highlightthickness: str | float = ..., + padx: str | float = ..., + pady: str | float = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., + width: str | float = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -2292,36 +2277,36 @@ class Label(Widget): *, activebackground: str = ..., activeforeground: str = ..., - anchor: _Anchor = "center", + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = "center", background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., bitmap: str = "", - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., - compound: _Compound = "none", + border: str | float = ..., + borderwidth: str | float = ..., + compound: Literal["top", "left", "center", "right", "bottom", "none"] = "none", cursor: _Cursor = "", disabledforeground: str = ..., fg: str = ..., font: _FontDescription = "TkDefaultFont", foreground: str = ..., - height: _ScreenUnits = 0, + height: str | float = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = 0, - image: _ImageSpec = "", + highlightthickness: str | float = 0, + image: _Image | str = "", justify: Literal["left", "center", "right"] = "center", name: str = ..., - padx: _ScreenUnits = 1, - pady: _ScreenUnits = 1, - relief: _Relief = "flat", + padx: str | float = 1, + pady: str | float = 1, + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", state: Literal["normal", "active", "disabled"] = "normal", - takefocus: _TakeFocusValue = 0, + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = 0, text: float | str = "", textvariable: Variable = ..., underline: int = -1, - width: _ScreenUnits = 0, - wraplength: _ScreenUnits = 0, + width: str | float = 0, + wraplength: str | float = 0, ) -> None: ... @overload def configure( @@ -2330,35 +2315,35 @@ class Label(Widget): *, activebackground: str = ..., activeforeground: str = ..., - anchor: _Anchor = ..., + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., bitmap: str = ..., - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., - compound: _Compound = ..., + border: str | float = ..., + borderwidth: str | float = ..., + compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., cursor: _Cursor = ..., disabledforeground: str = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: _ScreenUnits = ..., + height: str | float = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = ..., - image: _ImageSpec = ..., + highlightthickness: str | float = ..., + image: _Image | str = ..., justify: Literal["left", "center", "right"] = ..., - padx: _ScreenUnits = ..., - pady: _ScreenUnits = ..., - relief: _Relief = ..., + padx: str | float = ..., + pady: str | float = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., state: Literal["normal", "active", "disabled"] = ..., - takefocus: _TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = ..., textvariable: Variable = ..., underline: int = ..., - width: _ScreenUnits = ..., - wraplength: _ScreenUnits = ..., + width: str | float = ..., + wraplength: str | float = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -2372,10 +2357,10 @@ class Listbox(Widget, XView, YView): *, activestyle: Literal["dotbox", "none", "underline"] = ..., background: str = ..., - bd: _ScreenUnits = 1, + bd: str | float = 1, bg: str = ..., - border: _ScreenUnits = 1, - borderwidth: _ScreenUnits = 1, + border: str | float = 1, + borderwidth: str | float = 1, cursor: _Cursor = "", disabledforeground: str = ..., exportselection: bool | Literal[0, 1] = 1, @@ -2385,7 +2370,7 @@ class Listbox(Widget, XView, YView): height: int = 10, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = ..., + highlightthickness: str | float = ..., justify: Literal["left", "center", "right"] = "left", # There's no tkinter.ListVar, but seems like bare tkinter.Variable # actually works for this: @@ -2398,9 +2383,9 @@ class Listbox(Widget, XView, YView): # ('foo', 'bar', 'baz') listvariable: Variable = ..., name: str = ..., - relief: _Relief = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., selectbackground: str = ..., - selectborderwidth: _ScreenUnits = 0, + selectborderwidth: str | float = 0, selectforeground: str = ..., # from listbox man page: "The value of the [selectmode] option may be # arbitrary, but the default bindings expect it to be either single, @@ -2411,10 +2396,10 @@ class Listbox(Widget, XView, YView): selectmode: str | Literal["single", "browse", "multiple", "extended"] = "browse", # noqa: Y051 setgrid: bool = False, state: Literal["normal", "disabled"] = "normal", - takefocus: _TakeFocusValue = "", + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", width: int = 20, - xscrollcommand: _XYScrollCommand = "", - yscrollcommand: _XYScrollCommand = "", + xscrollcommand: str | Callable[[float, float], object] = "", + yscrollcommand: str | Callable[[float, float], object] = "", ) -> None: ... @overload def configure( @@ -2423,10 +2408,10 @@ class Listbox(Widget, XView, YView): *, activestyle: Literal["dotbox", "none", "underline"] = ..., background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., cursor: _Cursor = ..., disabledforeground: str = ..., exportselection: bool = ..., @@ -2436,20 +2421,20 @@ class Listbox(Widget, XView, YView): height: int = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = ..., + highlightthickness: str | float = ..., justify: Literal["left", "center", "right"] = ..., listvariable: Variable = ..., - relief: _Relief = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., selectbackground: str = ..., - selectborderwidth: _ScreenUnits = ..., + selectborderwidth: str | float = ..., selectforeground: str = ..., selectmode: str | Literal["single", "browse", "multiple", "extended"] = ..., # noqa: Y051 setgrid: bool = ..., state: Literal["normal", "disabled"] = ..., - takefocus: _TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., width: int = ..., - xscrollcommand: _XYScrollCommand = ..., - yscrollcommand: _XYScrollCommand = ..., + xscrollcommand: str | Callable[[float, float], object] = ..., + yscrollcommand: str | Callable[[float, float], object] = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -2485,13 +2470,13 @@ class Menu(Widget): cnf: dict[str, Any] | None = {}, *, activebackground: str = ..., - activeborderwidth: _ScreenUnits = ..., + activeborderwidth: str | float = ..., activeforeground: str = ..., background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., cursor: _Cursor = "arrow", disabledforeground: str = ..., fg: str = ..., @@ -2499,9 +2484,9 @@ class Menu(Widget): foreground: str = ..., name: str = ..., postcommand: Callable[[], object] | str = "", - relief: _Relief = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., selectcolor: str = ..., - takefocus: _TakeFocusValue = 0, + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = 0, tearoff: bool | Literal[0, 1] = 1, # I guess tearoffcommand arguments are supposed to be widget objects, # but they are widget name strings. Use nametowidget() to handle the @@ -2516,22 +2501,22 @@ class Menu(Widget): cnf: dict[str, Any] | None = None, *, activebackground: str = ..., - activeborderwidth: _ScreenUnits = ..., + activeborderwidth: str | float = ..., activeforeground: str = ..., background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., cursor: _Cursor = ..., disabledforeground: str = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., postcommand: Callable[[], object] | str = ..., - relief: _Relief = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., selectcolor: str = ..., - takefocus: _TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., tearoff: bool = ..., tearoffcommand: Callable[[str, str], object] | str = ..., title: str = ..., @@ -2555,11 +2540,11 @@ class Menu(Widget): bitmap: str = ..., columnbreak: int = ..., command: Callable[[], object] | str = ..., - compound: _Compound = ..., + compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., font: _FontDescription = ..., foreground: str = ..., hidemargin: bool = ..., - image: _ImageSpec = ..., + image: _Image | str = ..., label: str = ..., menu: Menu = ..., state: Literal["normal", "active", "disabled"] = ..., @@ -2576,17 +2561,17 @@ class Menu(Widget): bitmap: str = ..., columnbreak: int = ..., command: Callable[[], object] | str = ..., - compound: _Compound = ..., + compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., font: _FontDescription = ..., foreground: str = ..., hidemargin: bool = ..., - image: _ImageSpec = ..., + image: _Image | str = ..., indicatoron: bool = ..., label: str = ..., offvalue: Any = ..., onvalue: Any = ..., selectcolor: str = ..., - selectimage: _ImageSpec = ..., + selectimage: _Image | str = ..., state: Literal["normal", "active", "disabled"] = ..., underline: int = ..., variable: Variable = ..., @@ -2602,11 +2587,11 @@ class Menu(Widget): bitmap: str = ..., columnbreak: int = ..., command: Callable[[], object] | str = ..., - compound: _Compound = ..., + compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., font: _FontDescription = ..., foreground: str = ..., hidemargin: bool = ..., - image: _ImageSpec = ..., + image: _Image | str = ..., label: str = ..., state: Literal["normal", "active", "disabled"] = ..., underline: int = ..., @@ -2622,15 +2607,15 @@ class Menu(Widget): bitmap: str = ..., columnbreak: int = ..., command: Callable[[], object] | str = ..., - compound: _Compound = ..., + compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., font: _FontDescription = ..., foreground: str = ..., hidemargin: bool = ..., - image: _ImageSpec = ..., + image: _Image | str = ..., indicatoron: bool = ..., label: str = ..., selectcolor: str = ..., - selectimage: _ImageSpec = ..., + selectimage: _Image | str = ..., state: Literal["normal", "active", "disabled"] = ..., underline: int = ..., value: Any = ..., @@ -2649,11 +2634,11 @@ class Menu(Widget): bitmap: str = ..., columnbreak: int = ..., command: Callable[[], object] | str = ..., - compound: _Compound = ..., + compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., font: _FontDescription = ..., foreground: str = ..., hidemargin: bool = ..., - image: _ImageSpec = ..., + image: _Image | str = ..., label: str = ..., menu: Menu = ..., state: Literal["normal", "active", "disabled"] = ..., @@ -2671,17 +2656,17 @@ class Menu(Widget): bitmap: str = ..., columnbreak: int = ..., command: Callable[[], object] | str = ..., - compound: _Compound = ..., + compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., font: _FontDescription = ..., foreground: str = ..., hidemargin: bool = ..., - image: _ImageSpec = ..., + image: _Image | str = ..., indicatoron: bool = ..., label: str = ..., offvalue: Any = ..., onvalue: Any = ..., selectcolor: str = ..., - selectimage: _ImageSpec = ..., + selectimage: _Image | str = ..., state: Literal["normal", "active", "disabled"] = ..., underline: int = ..., variable: Variable = ..., @@ -2698,11 +2683,11 @@ class Menu(Widget): bitmap: str = ..., columnbreak: int = ..., command: Callable[[], object] | str = ..., - compound: _Compound = ..., + compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., font: _FontDescription = ..., foreground: str = ..., hidemargin: bool = ..., - image: _ImageSpec = ..., + image: _Image | str = ..., label: str = ..., state: Literal["normal", "active", "disabled"] = ..., underline: int = ..., @@ -2719,15 +2704,15 @@ class Menu(Widget): bitmap: str = ..., columnbreak: int = ..., command: Callable[[], object] | str = ..., - compound: _Compound = ..., + compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., font: _FontDescription = ..., foreground: str = ..., hidemargin: bool = ..., - image: _ImageSpec = ..., + image: _Image | str = ..., indicatoron: bool = ..., label: str = ..., selectcolor: str = ..., - selectimage: _ImageSpec = ..., + selectimage: _Image | str = ..., state: Literal["normal", "active", "disabled"] = ..., underline: int = ..., value: Any = ..., @@ -2756,39 +2741,39 @@ class Menubutton(Widget): *, activebackground: str = ..., activeforeground: str = ..., - anchor: _Anchor = ..., + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., bitmap: str = "", - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., - compound: _Compound = "none", + border: str | float = ..., + borderwidth: str | float = ..., + compound: Literal["top", "left", "center", "right", "bottom", "none"] = "none", cursor: _Cursor = "", direction: Literal["above", "below", "left", "right", "flush"] = "below", disabledforeground: str = ..., fg: str = ..., font: _FontDescription = "TkDefaultFont", foreground: str = ..., - height: _ScreenUnits = 0, + height: str | float = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = 0, - image: _ImageSpec = "", + highlightthickness: str | float = 0, + image: _Image | str = "", indicatoron: bool = ..., justify: Literal["left", "center", "right"] = ..., menu: Menu = ..., name: str = ..., - padx: _ScreenUnits = ..., - pady: _ScreenUnits = ..., - relief: _Relief = "flat", + padx: str | float = ..., + pady: str | float = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", state: Literal["normal", "active", "disabled"] = "normal", - takefocus: _TakeFocusValue = 0, + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = 0, text: float | str = "", textvariable: Variable = ..., underline: int = -1, - width: _ScreenUnits = 0, - wraplength: _ScreenUnits = 0, + width: str | float = 0, + wraplength: str | float = 0, ) -> None: ... @overload def configure( @@ -2797,38 +2782,38 @@ class Menubutton(Widget): *, activebackground: str = ..., activeforeground: str = ..., - anchor: _Anchor = ..., + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., bitmap: str = ..., - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., - compound: _Compound = ..., + border: str | float = ..., + borderwidth: str | float = ..., + compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., cursor: _Cursor = ..., direction: Literal["above", "below", "left", "right", "flush"] = ..., disabledforeground: str = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: _ScreenUnits = ..., + height: str | float = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = ..., - image: _ImageSpec = ..., + highlightthickness: str | float = ..., + image: _Image | str = ..., indicatoron: bool = ..., justify: Literal["left", "center", "right"] = ..., menu: Menu = ..., - padx: _ScreenUnits = ..., - pady: _ScreenUnits = ..., - relief: _Relief = ..., + padx: str | float = ..., + pady: str | float = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., state: Literal["normal", "active", "disabled"] = ..., - takefocus: _TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = ..., textvariable: Variable = ..., underline: int = ..., - width: _ScreenUnits = ..., - wraplength: _ScreenUnits = ..., + width: str | float = ..., + wraplength: str | float = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -2840,58 +2825,58 @@ class Message(Widget): master: Misc | None = None, cnf: dict[str, Any] | None = {}, *, - anchor: _Anchor = "center", + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = "center", aspect: int = 150, background: str = ..., - bd: _ScreenUnits = 1, + bd: str | float = 1, bg: str = ..., - border: _ScreenUnits = 1, - borderwidth: _ScreenUnits = 1, + border: str | float = 1, + borderwidth: str | float = 1, cursor: _Cursor = "", fg: str = ..., font: _FontDescription = "TkDefaultFont", foreground: str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = 0, + highlightthickness: str | float = 0, justify: Literal["left", "center", "right"] = "left", name: str = ..., - padx: _ScreenUnits = ..., - pady: _ScreenUnits = ..., - relief: _Relief = "flat", - takefocus: _TakeFocusValue = 0, + padx: str | float = ..., + pady: str | float = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = 0, text: float | str = "", textvariable: Variable = ..., # there's width but no height - width: _ScreenUnits = 0, + width: str | float = 0, ) -> None: ... @overload def configure( self, cnf: dict[str, Any] | None = None, *, - anchor: _Anchor = ..., + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., aspect: int = ..., background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., cursor: _Cursor = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = ..., + highlightthickness: str | float = ..., justify: Literal["left", "center", "right"] = ..., - padx: _ScreenUnits = ..., - pady: _ScreenUnits = ..., - relief: _Relief = ..., - takefocus: _TakeFocusValue = ..., + padx: str | float = ..., + pady: str | float = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = ..., textvariable: Variable = ..., - width: _ScreenUnits = ..., + width: str | float = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -2905,46 +2890,46 @@ class Radiobutton(Widget): *, activebackground: str = ..., activeforeground: str = ..., - anchor: _Anchor = "center", + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = "center", background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., bitmap: str = "", - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., - command: _ButtonCommand = "", - compound: _Compound = "none", + border: str | float = ..., + borderwidth: str | float = ..., + command: str | Callable[[], Any] = "", + compound: Literal["top", "left", "center", "right", "bottom", "none"] = "none", cursor: _Cursor = "", disabledforeground: str = ..., fg: str = ..., font: _FontDescription = "TkDefaultFont", foreground: str = ..., - height: _ScreenUnits = 0, + height: str | float = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = 1, - image: _ImageSpec = "", + highlightthickness: str | float = 1, + image: _Image | str = "", indicatoron: bool = True, justify: Literal["left", "center", "right"] = "center", name: str = ..., - offrelief: _Relief = ..., - overrelief: _Relief | Literal[""] = "", - padx: _ScreenUnits = 1, - pady: _ScreenUnits = 1, - relief: _Relief = "flat", + offrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + overrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove", ""] = "", + padx: str | float = 1, + pady: str | float = 1, + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", selectcolor: str = ..., - selectimage: _ImageSpec = "", + selectimage: _Image | str = "", state: Literal["normal", "active", "disabled"] = "normal", - takefocus: _TakeFocusValue = "", + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", text: float | str = "", textvariable: Variable = ..., - tristateimage: _ImageSpec = "", + tristateimage: _Image | str = "", tristatevalue: Any = "", underline: int = -1, value: Any = "", variable: Variable | Literal[""] = ..., - width: _ScreenUnits = 0, - wraplength: _ScreenUnits = 0, + width: str | float = 0, + wraplength: str | float = 0, ) -> None: ... @overload def configure( @@ -2953,45 +2938,45 @@ class Radiobutton(Widget): *, activebackground: str = ..., activeforeground: str = ..., - anchor: _Anchor = ..., + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., bitmap: str = ..., - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., - command: _ButtonCommand = ..., - compound: _Compound = ..., + border: str | float = ..., + borderwidth: str | float = ..., + command: str | Callable[[], Any] = ..., + compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., cursor: _Cursor = ..., disabledforeground: str = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: _ScreenUnits = ..., + height: str | float = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = ..., - image: _ImageSpec = ..., + highlightthickness: str | float = ..., + image: _Image | str = ..., indicatoron: bool = ..., justify: Literal["left", "center", "right"] = ..., - offrelief: _Relief = ..., - overrelief: _Relief | Literal[""] = ..., - padx: _ScreenUnits = ..., - pady: _ScreenUnits = ..., - relief: _Relief = ..., + offrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + overrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove", ""] = ..., + padx: str | float = ..., + pady: str | float = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., selectcolor: str = ..., - selectimage: _ImageSpec = ..., + selectimage: _Image | str = ..., state: Literal["normal", "active", "disabled"] = ..., - takefocus: _TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = ..., textvariable: Variable = ..., - tristateimage: _ImageSpec = ..., + tristateimage: _Image | str = ..., tristatevalue: Any = ..., underline: int = ..., value: Any = ..., variable: Variable | Literal[""] = ..., - width: _ScreenUnits = ..., - wraplength: _ScreenUnits = ..., + width: str | float = ..., + wraplength: str | float = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -3009,11 +2994,11 @@ class Scale(Widget): *, activebackground: str = ..., background: str = ..., - bd: _ScreenUnits = 1, + bd: str | float = 1, bg: str = ..., bigincrement: float = 0.0, - border: _ScreenUnits = 1, - borderwidth: _ScreenUnits = 1, + border: str | float = 1, + borderwidth: str | float = 1, # don't know why the callback gets string instead of float command: str | Callable[[str], object] = "", cursor: _Cursor = "", @@ -3024,25 +3009,25 @@ class Scale(Widget): from_: float = 0.0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = ..., + highlightthickness: str | float = ..., label: str = "", - length: _ScreenUnits = 100, + length: str | float = 100, name: str = ..., orient: Literal["horizontal", "vertical"] = "vertical", - relief: _Relief = "flat", + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", repeatdelay: int = 300, repeatinterval: int = 100, resolution: float = 1.0, showvalue: bool = True, - sliderlength: _ScreenUnits = 30, - sliderrelief: _Relief = "raised", + sliderlength: str | float = 30, + sliderrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "raised", state: Literal["normal", "active", "disabled"] = "normal", - takefocus: _TakeFocusValue = "", + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", tickinterval: float = 0.0, to: float = 100.0, troughcolor: str = ..., variable: IntVar | DoubleVar = ..., - width: _ScreenUnits = 15, + width: str | float = 15, ) -> None: ... @overload def configure( @@ -3051,11 +3036,11 @@ class Scale(Widget): *, activebackground: str = ..., background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., bigincrement: float = ..., - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., command: str | Callable[[str], object] = ..., cursor: _Cursor = ..., digits: int = ..., @@ -3065,24 +3050,24 @@ class Scale(Widget): from_: float = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = ..., + highlightthickness: str | float = ..., label: str = ..., - length: _ScreenUnits = ..., + length: str | float = ..., orient: Literal["horizontal", "vertical"] = ..., - relief: _Relief = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., repeatdelay: int = ..., repeatinterval: int = ..., resolution: float = ..., showvalue: bool = ..., - sliderlength: _ScreenUnits = ..., - sliderrelief: _Relief = ..., + sliderlength: str | float = ..., + sliderrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., state: Literal["normal", "active", "disabled"] = ..., - takefocus: _TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., tickinterval: float = ..., to: float = ..., troughcolor: str = ..., variable: IntVar | DoubleVar = ..., - width: _ScreenUnits = ..., + width: str | float = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -3099,31 +3084,31 @@ class Scrollbar(Widget): cnf: dict[str, Any] | None = {}, *, activebackground: str = ..., - activerelief: _Relief = "raised", + activerelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "raised", background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., # There are many ways how the command may get called. Search for # 'SCROLLING COMMANDS' in scrollbar man page. There doesn't seem to # be any way to specify an overloaded callback function, so we say # that it can take any args while it can't in reality. command: Callable[..., tuple[float, float] | None] | str = "", cursor: _Cursor = "", - elementborderwidth: _ScreenUnits = -1, + elementborderwidth: str | float = -1, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = 0, + highlightthickness: str | float = 0, jump: bool = False, name: str = ..., orient: Literal["horizontal", "vertical"] = "vertical", - relief: _Relief = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., repeatdelay: int = 300, repeatinterval: int = 100, - takefocus: _TakeFocusValue = "", + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", troughcolor: str = ..., - width: _ScreenUnits = ..., + width: str | float = ..., ) -> None: ... @overload def configure( @@ -3131,26 +3116,26 @@ class Scrollbar(Widget): cnf: dict[str, Any] | None = None, *, activebackground: str = ..., - activerelief: _Relief = ..., + activerelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., command: Callable[..., tuple[float, float] | None] | str = ..., cursor: _Cursor = ..., - elementborderwidth: _ScreenUnits = ..., + elementborderwidth: str | float = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = ..., + highlightthickness: str | float = ..., jump: bool = ..., orient: Literal["horizontal", "vertical"] = ..., - relief: _Relief = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., repeatdelay: int = ..., repeatinterval: int = ..., - takefocus: _TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., troughcolor: str = ..., - width: _ScreenUnits = ..., + width: str | float = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -3175,11 +3160,11 @@ class Text(Widget, XView, YView): *, autoseparators: bool = True, background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., blockcursor: bool = False, - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., cursor: _Cursor = "xterm", endline: int | Literal[""] = "", exportselection: bool = True, @@ -3189,40 +3174,40 @@ class Text(Widget, XView, YView): # width is always int, but height is allowed to be ScreenUnits. # This doesn't make any sense to me, and this isn't documented. # The docs seem to say that both should be integers. - height: _ScreenUnits = 24, + height: str | float = 24, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = ..., + highlightthickness: str | float = ..., inactiveselectbackground: str = ..., insertbackground: str = ..., - insertborderwidth: _ScreenUnits = 0, + insertborderwidth: str | float = 0, insertofftime: int = 300, insertontime: int = 600, insertunfocussed: Literal["none", "hollow", "solid"] = "none", - insertwidth: _ScreenUnits = ..., + insertwidth: str | float = ..., maxundo: int = 0, name: str = ..., - padx: _ScreenUnits = 1, - pady: _ScreenUnits = 1, - relief: _Relief = ..., + padx: str | float = 1, + pady: str | float = 1, + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., selectbackground: str = ..., - selectborderwidth: _ScreenUnits = ..., + selectborderwidth: str | float = ..., selectforeground: str = ..., setgrid: bool = False, - spacing1: _ScreenUnits = 0, - spacing2: _ScreenUnits = 0, - spacing3: _ScreenUnits = 0, + spacing1: str | float = 0, + spacing2: str | float = 0, + spacing3: str | float = 0, startline: int | Literal[""] = "", state: Literal["normal", "disabled"] = "normal", # Literal inside Tuple doesn't actually work - tabs: _ScreenUnits | str | tuple[_ScreenUnits | str, ...] = "", + tabs: str | float | tuple[str | float, ...] = "", tabstyle: Literal["tabular", "wordprocessor"] = "tabular", - takefocus: _TakeFocusValue = "", + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", undo: bool = False, width: int = 80, wrap: Literal["none", "char", "word"] = "char", - xscrollcommand: _XYScrollCommand = "", - yscrollcommand: _XYScrollCommand = "", + xscrollcommand: str | Callable[[float, float], object] = "", + yscrollcommand: str | Callable[[float, float], object] = "", ) -> None: ... @overload def configure( @@ -3231,49 +3216,49 @@ class Text(Widget, XView, YView): *, autoseparators: bool = ..., background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., blockcursor: bool = ..., - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., cursor: _Cursor = ..., endline: int | Literal[""] = ..., exportselection: bool = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: _ScreenUnits = ..., + height: str | float = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = ..., + highlightthickness: str | float = ..., inactiveselectbackground: str = ..., insertbackground: str = ..., - insertborderwidth: _ScreenUnits = ..., + insertborderwidth: str | float = ..., insertofftime: int = ..., insertontime: int = ..., insertunfocussed: Literal["none", "hollow", "solid"] = ..., - insertwidth: _ScreenUnits = ..., + insertwidth: str | float = ..., maxundo: int = ..., - padx: _ScreenUnits = ..., - pady: _ScreenUnits = ..., - relief: _Relief = ..., + padx: str | float = ..., + pady: str | float = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., selectbackground: str = ..., - selectborderwidth: _ScreenUnits = ..., + selectborderwidth: str | float = ..., selectforeground: str = ..., setgrid: bool = ..., - spacing1: _ScreenUnits = ..., - spacing2: _ScreenUnits = ..., - spacing3: _ScreenUnits = ..., + spacing1: str | float = ..., + spacing2: str | float = ..., + spacing3: str | float = ..., startline: int | Literal[""] = ..., state: Literal["normal", "disabled"] = ..., - tabs: _ScreenUnits | str | tuple[_ScreenUnits | str, ...] = ..., + tabs: str | float | tuple[str | float, ...] = ..., tabstyle: Literal["tabular", "wordprocessor"] = ..., - takefocus: _TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., undo: bool = ..., width: int = ..., wrap: Literal["none", "char", "word"] = ..., - xscrollcommand: _XYScrollCommand = ..., - yscrollcommand: _XYScrollCommand = ..., + xscrollcommand: str | Callable[[float, float], object] = ..., + yscrollcommand: str | Callable[[float, float], object] = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -3482,10 +3467,10 @@ class Text(Widget, XView, YView): cnf: dict[str, Any] | None = None, *, align: Literal["baseline", "bottom", "center", "top"] = ..., - image: _ImageSpec = ..., + image: _Image | str = ..., name: str = ..., - padx: _ScreenUnits = ..., - pady: _ScreenUnits = ..., + padx: str | float = ..., + pady: str | float = ..., ) -> dict[str, tuple[str, str, str, str, str | int]] | None: ... def image_create( self, @@ -3493,10 +3478,10 @@ class Text(Widget, XView, YView): cnf: dict[str, Any] | None = {}, *, align: Literal["baseline", "bottom", "center", "top"] = ..., - image: _ImageSpec = ..., + image: _Image | str = ..., name: str = ..., - padx: _ScreenUnits = ..., - pady: _ScreenUnits = ..., + padx: str | float = ..., + pady: str | float = ..., ) -> str: ... def image_names(self) -> tuple[str, ...]: ... def index(self, index: _TextIndex) -> str: ... @@ -3553,27 +3538,27 @@ class Text(Widget, XView, YView): *, background: str = ..., bgstipple: str = ..., - borderwidth: _ScreenUnits = ..., - border: _ScreenUnits = ..., # alias for borderwidth + borderwidth: str | float = ..., + border: str | float = ..., # alias for borderwidth elide: bool = ..., fgstipple: str = ..., font: _FontDescription = ..., foreground: str = ..., justify: Literal["left", "right", "center"] = ..., - lmargin1: _ScreenUnits = ..., - lmargin2: _ScreenUnits = ..., + lmargin1: str | float = ..., + lmargin2: str | float = ..., lmargincolor: str = ..., - offset: _ScreenUnits = ..., + offset: str | float = ..., overstrike: bool = ..., overstrikefg: str = ..., - relief: _Relief = ..., - rmargin: _ScreenUnits = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + rmargin: str | float = ..., rmargincolor: str = ..., selectbackground: str = ..., selectforeground: str = ..., - spacing1: _ScreenUnits = ..., - spacing2: _ScreenUnits = ..., - spacing3: _ScreenUnits = ..., + spacing1: str | float = ..., + spacing2: str | float = ..., + spacing3: str | float = ..., tabs: Any = ..., # the exact type is kind of complicated, see manual page tabstyle: Literal["tabular", "wordprocessor"] = ..., underline: bool = ..., @@ -3616,8 +3601,8 @@ class Text(Widget, XView, YView): *, align: Literal["baseline", "bottom", "center", "top"] = ..., create: str = ..., - padx: _ScreenUnits = ..., - pady: _ScreenUnits = ..., + padx: str | float = ..., + pady: str | float = ..., stretch: bool | Literal[0, 1] = ..., window: Misc | str = ..., ) -> dict[str, tuple[str, str, str, str, str | int]] | None: ... @@ -3629,8 +3614,8 @@ class Text(Widget, XView, YView): *, align: Literal["baseline", "bottom", "center", "top"] = ..., create: str = ..., - padx: _ScreenUnits = ..., - pady: _ScreenUnits = ..., + padx: str | float = ..., + pady: str | float = ..., stretch: bool | Literal[0, 1] = ..., window: Misc | str = ..., ) -> None: ... @@ -3825,14 +3810,14 @@ class Spinbox(Widget, XView): *, activebackground: str = ..., background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., buttonbackground: str = ..., buttoncursor: _Cursor = "", - buttondownrelief: _Relief = ..., - buttonuprelief: _Relief = ..., + buttondownrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + buttonuprelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., # percent substitutions don't seem to be supported, it's similar to Entry's validation stuff command: Callable[[], object] | str | list[str] | tuple[str, ...] = "", cursor: _Cursor = "xterm", @@ -3846,35 +3831,35 @@ class Spinbox(Widget, XView): from_: float = 0.0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = ..., + highlightthickness: str | float = ..., increment: float = 1.0, insertbackground: str = ..., - insertborderwidth: _ScreenUnits = 0, + insertborderwidth: str | float = 0, insertofftime: int = 300, insertontime: int = 600, - insertwidth: _ScreenUnits = ..., - invalidcommand: _EntryValidateCommand = "", - invcmd: _EntryValidateCommand = "", + insertwidth: str | float = ..., + invalidcommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = "", + invcmd: str | list[str] | tuple[str, ...] | Callable[[], bool] = "", justify: Literal["left", "center", "right"] = "left", name: str = ..., readonlybackground: str = ..., - relief: _Relief = "sunken", + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "sunken", repeatdelay: int = 400, repeatinterval: int = 100, selectbackground: str = ..., - selectborderwidth: _ScreenUnits = ..., + selectborderwidth: str | float = ..., selectforeground: str = ..., state: Literal["normal", "disabled", "readonly"] = "normal", - takefocus: _TakeFocusValue = "", + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", textvariable: Variable = ..., to: float = 0.0, validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = "none", - validatecommand: _EntryValidateCommand = "", - vcmd: _EntryValidateCommand = "", + validatecommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = "", + vcmd: str | list[str] | tuple[str, ...] | Callable[[], bool] = "", values: list[str] | tuple[str, ...] = ..., width: int = 20, wrap: bool = False, - xscrollcommand: _XYScrollCommand = "", + xscrollcommand: str | Callable[[float, float], object] = "", ) -> None: ... @overload def configure( @@ -3883,14 +3868,14 @@ class Spinbox(Widget, XView): *, activebackground: str = ..., background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., buttonbackground: str = ..., buttoncursor: _Cursor = ..., - buttondownrelief: _Relief = ..., - buttonuprelief: _Relief = ..., + buttondownrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + buttonuprelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., command: Callable[[], object] | str | list[str] | tuple[str, ...] = ..., cursor: _Cursor = ..., disabledbackground: str = ..., @@ -3903,34 +3888,34 @@ class Spinbox(Widget, XView): from_: float = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = ..., + highlightthickness: str | float = ..., increment: float = ..., insertbackground: str = ..., - insertborderwidth: _ScreenUnits = ..., + insertborderwidth: str | float = ..., insertofftime: int = ..., insertontime: int = ..., - insertwidth: _ScreenUnits = ..., - invalidcommand: _EntryValidateCommand = ..., - invcmd: _EntryValidateCommand = ..., + insertwidth: str | float = ..., + invalidcommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., + invcmd: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., justify: Literal["left", "center", "right"] = ..., readonlybackground: str = ..., - relief: _Relief = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., repeatdelay: int = ..., repeatinterval: int = ..., selectbackground: str = ..., - selectborderwidth: _ScreenUnits = ..., + selectborderwidth: str | float = ..., selectforeground: str = ..., state: Literal["normal", "disabled", "readonly"] = ..., - takefocus: _TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., textvariable: Variable = ..., to: float = ..., validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ..., - validatecommand: _EntryValidateCommand = ..., - vcmd: _EntryValidateCommand = ..., + validatecommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., + vcmd: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., values: list[str] | tuple[str, ...] = ..., width: int = ..., wrap: bool = ..., - xscrollcommand: _XYScrollCommand = ..., + xscrollcommand: str | Callable[[float, float], object] = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -3963,10 +3948,10 @@ class LabelFrame(Widget): cnf: dict[str, Any] | None = {}, *, background: str = ..., - bd: _ScreenUnits = 2, + bd: str | float = 2, bg: str = ..., - border: _ScreenUnits = 2, - borderwidth: _ScreenUnits = 2, + border: str | float = 2, + borderwidth: str | float = 2, class_: str = "Labelframe", # can't be changed with configure() colormap: Literal["new", ""] | Misc = "", # can't be changed with configure() container: bool = False, # undocumented, can't be changed with configure() @@ -3974,21 +3959,21 @@ class LabelFrame(Widget): fg: str = ..., font: _FontDescription = "TkDefaultFont", foreground: str = ..., - height: _ScreenUnits = 0, + height: str | float = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = 0, + highlightthickness: str | float = 0, # 'ne' and 'en' are valid labelanchors, but only 'ne' is a valid _Anchor. labelanchor: Literal["nw", "n", "ne", "en", "e", "es", "se", "s", "sw", "ws", "w", "wn"] = "nw", labelwidget: Misc = ..., name: str = ..., - padx: _ScreenUnits = 0, - pady: _ScreenUnits = 0, - relief: _Relief = "groove", - takefocus: _TakeFocusValue = 0, + padx: str | float = 0, + pady: str | float = 0, + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "groove", + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = 0, text: float | str = "", visual: str | tuple[str, int] = "", # can't be changed with configure() - width: _ScreenUnits = 0, + width: str | float = 0, ) -> None: ... @overload def configure( @@ -3996,26 +3981,26 @@ class LabelFrame(Widget): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., cursor: _Cursor = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: _ScreenUnits = ..., + height: str | float = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = ..., + highlightthickness: str | float = ..., labelanchor: Literal["nw", "n", "ne", "en", "e", "es", "se", "s", "sw", "ws", "w", "wn"] = ..., labelwidget: Misc = ..., - padx: _ScreenUnits = ..., - pady: _ScreenUnits = ..., - relief: _Relief = ..., - takefocus: _TakeFocusValue = ..., + padx: str | float = ..., + pady: str | float = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = ..., - width: _ScreenUnits = ..., + width: str | float = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -4028,27 +4013,27 @@ class PanedWindow(Widget): cnf: dict[str, Any] | None = {}, *, background: str = ..., - bd: _ScreenUnits = 1, + bd: str | float = 1, bg: str = ..., - border: _ScreenUnits = 1, - borderwidth: _ScreenUnits = 1, + border: str | float = 1, + borderwidth: str | float = 1, cursor: _Cursor = "", - handlepad: _ScreenUnits = 8, - handlesize: _ScreenUnits = 8, - height: _ScreenUnits = "", + handlepad: str | float = 8, + handlesize: str | float = 8, + height: str | float = "", name: str = ..., opaqueresize: bool = True, orient: Literal["horizontal", "vertical"] = "horizontal", proxybackground: str = "", - proxyborderwidth: _ScreenUnits = 2, - proxyrelief: _Relief = "flat", - relief: _Relief = "flat", + proxyborderwidth: str | float = 2, + proxyrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", sashcursor: _Cursor = "", - sashpad: _ScreenUnits = 0, - sashrelief: _Relief = "flat", - sashwidth: _ScreenUnits = 3, + sashpad: str | float = 0, + sashrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", + sashwidth: str | float = 3, showhandle: bool = False, - width: _ScreenUnits = "", + width: str | float = "", ) -> None: ... @overload def configure( @@ -4056,26 +4041,26 @@ class PanedWindow(Widget): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: _ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., - border: _ScreenUnits = ..., - borderwidth: _ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., cursor: _Cursor = ..., - handlepad: _ScreenUnits = ..., - handlesize: _ScreenUnits = ..., - height: _ScreenUnits = ..., + handlepad: str | float = ..., + handlesize: str | float = ..., + height: str | float = ..., opaqueresize: bool = ..., orient: Literal["horizontal", "vertical"] = ..., proxybackground: str = ..., - proxyborderwidth: _ScreenUnits = ..., - proxyrelief: _Relief = ..., - relief: _Relief = ..., + proxyborderwidth: str | float = ..., + proxyrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., sashcursor: _Cursor = ..., - sashpad: _ScreenUnits = ..., - sashrelief: _Relief = ..., - sashwidth: _ScreenUnits = ..., + sashpad: str | float = ..., + sashrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + sashwidth: str | float = ..., showhandle: bool = ..., - width: _ScreenUnits = ..., + width: str | float = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... diff --git a/stdlib/tkinter/ttk.pyi b/stdlib/tkinter/ttk.pyi index 86c55eba7006..ae69bd779c8f 100644 --- a/stdlib/tkinter/ttk.pyi +++ b/stdlib/tkinter/ttk.pyi @@ -39,21 +39,22 @@ def tclobjs_to_py(adict: dict[Any, Any]) -> dict[Any, Any]: ... def setup_master(master: tkinter.Misc | None = None): ... _Padding: TypeAlias = ( - tkinter._ScreenUnits - | tuple[tkinter._ScreenUnits] - | tuple[tkinter._ScreenUnits, tkinter._ScreenUnits] - | tuple[tkinter._ScreenUnits, tkinter._ScreenUnits, tkinter._ScreenUnits] - | tuple[tkinter._ScreenUnits, tkinter._ScreenUnits, tkinter._ScreenUnits, tkinter._ScreenUnits] + str + | float + | tuple[str | float] + | tuple[str | float, str | float] + | tuple[str | float, str | float, str | float] + | tuple[str | float, str | float, str | float, str | float] ) -# from ttk_widget (aka ttk::widget) manual page, differs from tkinter._Compound -_TtkCompound: TypeAlias = Literal["", "text", "image", tkinter._Compound] +# from ttk_widget (aka ttk::widget) manual page, differs from compound +_TtkCompound: TypeAlias = Literal["", "text", "image", "top", "left", "center", "right", "bottom", "none"] # Last item (option value to apply) varies between different options so use Any. # It could also be any iterable with items matching the tuple, but that case # hasn't been added here for consistency with _Padding above. _Statespec: TypeAlias = tuple[Unpack[tuple[str, ...]], Any] -_ImageStatespec: TypeAlias = tuple[Unpack[tuple[str, ...]], tkinter._ImageSpec] +_ImageStatespec: TypeAlias = tuple[Unpack[tuple[str, ...]], tkinter._Image | str] _VsapiStatespec: TypeAlias = tuple[Unpack[tuple[str, ...]], int] class _Layout(TypedDict, total=False): @@ -69,14 +70,14 @@ _LayoutSpec: TypeAlias = list[tuple[str, _Layout | None]] # Keep these in sync with the appropriate methods in Style class _ElementCreateImageKwargs(TypedDict, total=False): border: _Padding - height: tkinter._ScreenUnits + height: str | float padding: _Padding sticky: str - width: tkinter._ScreenUnits + width: str | float _ElementCreateArgsCrossPlatform: TypeAlias = ( # Could be any sequence here but types are not homogenous so just type it as tuple - tuple[Literal["image"], tkinter._ImageSpec, Unpack[tuple[_ImageStatespec, ...]], _ElementCreateImageKwargs] + tuple[Literal["image"], tkinter._Image | str, Unpack[tuple[_ImageStatespec, ...]], _ElementCreateImageKwargs] | tuple[Literal["from"], str, str] | tuple[Literal["from"], str] # (fromelement is optional) ) @@ -88,8 +89,8 @@ if sys.platform == "win32" and sys.version_info >= (3, 13): padding: _Padding class _ElementCreateVsapiKwargsSize(TypedDict): - width: tkinter._ScreenUnits - height: tkinter._ScreenUnits + width: str | float + height: str | float _ElementCreateVsapiKwargsDict: TypeAlias = ( _ElementCreateVsapiKwargsPadding | _ElementCreateVsapiKwargsMargin | _ElementCreateVsapiKwargsSize @@ -139,14 +140,14 @@ class Style: self, elementname: str, etype: Literal["image"], - default_image: tkinter._ImageSpec, + default_image: tkinter._Image | str, /, *imagespec: _ImageStatespec, border: _Padding = ..., - height: tkinter._ScreenUnits = ..., + height: str | float = ..., padding: _Padding = ..., sticky: str = ..., - width: tkinter._ScreenUnits = ..., + width: str | float = ..., ) -> None: ... @overload def element_create(self, elementname: str, etype: Literal["from"], themename: str, fromelement: str = ..., /) -> None: ... @@ -188,8 +189,8 @@ class Style: vs_statespec: _VsapiStatespec = ..., /, *, - width: tkinter._ScreenUnits, - height: tkinter._ScreenUnits, + width: str | float, + height: str | float, ) -> None: ... def element_names(self) -> tuple[str, ...]: ... @@ -214,16 +215,16 @@ class Button(Widget): master: tkinter.Misc | None = None, *, class_: str = "", - command: tkinter._ButtonCommand = "", + command: str | Callable[[], Any] = "", compound: _TtkCompound = "", cursor: tkinter._Cursor = "", default: Literal["normal", "active", "disabled"] = "normal", - image: tkinter._ImageSpec = "", + image: tkinter._Image | str = "", name: str = ..., padding=..., # undocumented state: str = "normal", style: str = "", - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = "", textvariable: tkinter.Variable = ..., underline: int = -1, @@ -234,15 +235,15 @@ class Button(Widget): self, cnf: dict[str, Any] | None = None, *, - command: tkinter._ButtonCommand = ..., + command: str | Callable[[], Any] = ..., compound: _TtkCompound = ..., cursor: tkinter._Cursor = ..., default: Literal["normal", "active", "disabled"] = ..., - image: tkinter._ImageSpec = ..., + image: tkinter._Image | str = ..., padding=..., state: str = ..., style: str = ..., - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = ..., textvariable: tkinter.Variable = ..., underline: int = ..., @@ -259,17 +260,17 @@ class Checkbutton(Widget): master: tkinter.Misc | None = None, *, class_: str = "", - command: tkinter._ButtonCommand = "", + command: str | Callable[[], Any] = "", compound: _TtkCompound = "", cursor: tkinter._Cursor = "", - image: tkinter._ImageSpec = "", + image: tkinter._Image | str = "", name: str = ..., offvalue: Any = 0, onvalue: Any = 1, padding=..., # undocumented state: str = "normal", style: str = "", - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = "", textvariable: tkinter.Variable = ..., underline: int = -1, @@ -284,16 +285,16 @@ class Checkbutton(Widget): self, cnf: dict[str, Any] | None = None, *, - command: tkinter._ButtonCommand = ..., + command: str | Callable[[], Any] = ..., compound: _TtkCompound = ..., cursor: tkinter._Cursor = ..., - image: tkinter._ImageSpec = ..., + image: tkinter._Image | str = ..., offvalue: Any = ..., onvalue: Any = ..., padding=..., state: str = ..., style: str = ..., - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = ..., textvariable: tkinter.Variable = ..., underline: int = ..., @@ -317,18 +318,18 @@ class Entry(Widget, tkinter.Entry): exportselection: bool = True, font: _FontDescription = "TkTextFont", foreground: str = "", - invalidcommand: tkinter._EntryValidateCommand = "", + invalidcommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = "", justify: Literal["left", "center", "right"] = "left", name: str = ..., show: str = "", state: str = "normal", style: str = "", - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., textvariable: tkinter.Variable = ..., validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = "none", - validatecommand: tkinter._EntryValidateCommand = "", + validatecommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = "", width: int = 20, - xscrollcommand: tkinter._XYScrollCommand = "", + xscrollcommand: str | Callable[[float, float], object] = "", ) -> None: ... @overload # type: ignore[override] def configure( @@ -340,17 +341,17 @@ class Entry(Widget, tkinter.Entry): exportselection: bool = ..., font: _FontDescription = ..., foreground: str = ..., - invalidcommand: tkinter._EntryValidateCommand = ..., + invalidcommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., justify: Literal["left", "center", "right"] = ..., show: str = ..., state: str = ..., style: str = ..., - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., textvariable: tkinter.Variable = ..., validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ..., - validatecommand: tkinter._EntryValidateCommand = ..., + validatecommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., width: int = ..., - xscrollcommand: tkinter._XYScrollCommand = ..., + xscrollcommand: str | Callable[[float, float], object] = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -365,17 +366,17 @@ class Entry(Widget, tkinter.Entry): exportselection: bool = ..., font: _FontDescription = ..., foreground: str = ..., - invalidcommand: tkinter._EntryValidateCommand = ..., + invalidcommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., justify: Literal["left", "center", "right"] = ..., show: str = ..., state: str = ..., style: str = ..., - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., textvariable: tkinter.Variable = ..., validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ..., - validatecommand: tkinter._EntryValidateCommand = ..., + validatecommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., width: int = ..., - xscrollcommand: tkinter._XYScrollCommand = ..., + xscrollcommand: str | Callable[[float, float], object] = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def config(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -395,20 +396,20 @@ class Combobox(Entry): font: _FontDescription = ..., # undocumented foreground: str = ..., # undocumented height: int = 10, - invalidcommand: tkinter._EntryValidateCommand = ..., # undocumented + invalidcommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., # undocumented justify: Literal["left", "center", "right"] = "left", name: str = ..., postcommand: Callable[[], object] | str = "", show=..., # undocumented state: str = "normal", style: str = "", - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., textvariable: tkinter.Variable = ..., validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ..., # undocumented - validatecommand: tkinter._EntryValidateCommand = ..., # undocumented + validatecommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., # undocumented values: list[str] | tuple[str, ...] = ..., width: int = 20, - xscrollcommand: tkinter._XYScrollCommand = ..., # undocumented + xscrollcommand: str | Callable[[float, float], object] = ..., # undocumented ) -> None: ... @overload # type: ignore[override] def configure( @@ -421,19 +422,19 @@ class Combobox(Entry): font: _FontDescription = ..., foreground: str = ..., height: int = ..., - invalidcommand: tkinter._EntryValidateCommand = ..., + invalidcommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., justify: Literal["left", "center", "right"] = ..., postcommand: Callable[[], object] | str = ..., show=..., state: str = ..., style: str = ..., - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., textvariable: tkinter.Variable = ..., validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ..., - validatecommand: tkinter._EntryValidateCommand = ..., + validatecommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., values: list[str] | tuple[str, ...] = ..., width: int = ..., - xscrollcommand: tkinter._XYScrollCommand = ..., + xscrollcommand: str | Callable[[float, float], object] = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -449,19 +450,19 @@ class Combobox(Entry): font: _FontDescription = ..., foreground: str = ..., height: int = ..., - invalidcommand: tkinter._EntryValidateCommand = ..., + invalidcommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., justify: Literal["left", "center", "right"] = ..., postcommand: Callable[[], object] | str = ..., show=..., state: str = ..., style: str = ..., - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., textvariable: tkinter.Variable = ..., validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ..., - validatecommand: tkinter._EntryValidateCommand = ..., + validatecommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., values: list[str] | tuple[str, ...] = ..., width: int = ..., - xscrollcommand: tkinter._XYScrollCommand = ..., + xscrollcommand: str | Callable[[float, float], object] = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def config(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -475,32 +476,32 @@ class Frame(Widget): self, master: tkinter.Misc | None = None, *, - border: tkinter._ScreenUnits = ..., - borderwidth: tkinter._ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., class_: str = "", cursor: tkinter._Cursor = "", - height: tkinter._ScreenUnits = 0, + height: str | float = 0, name: str = ..., padding: _Padding = ..., - relief: tkinter._Relief = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., style: str = "", - takefocus: tkinter._TakeFocusValue = "", - width: tkinter._ScreenUnits = 0, + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", + width: str | float = 0, ) -> None: ... @overload def configure( self, cnf: dict[str, Any] | None = None, *, - border: tkinter._ScreenUnits = ..., - borderwidth: tkinter._ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., cursor: tkinter._Cursor = ..., - height: tkinter._ScreenUnits = ..., + height: str | float = ..., padding: _Padding = ..., - relief: tkinter._Relief = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., style: str = ..., - takefocus: tkinter._TakeFocusValue = ..., - width: tkinter._ScreenUnits = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., + width: str | float = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -511,54 +512,54 @@ class Label(Widget): self, master: tkinter.Misc | None = None, *, - anchor: tkinter._Anchor = ..., + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., background: str = "", - border: tkinter._ScreenUnits = ..., # alias for borderwidth - borderwidth: tkinter._ScreenUnits = ..., # undocumented + border: str | float = ..., # alias for borderwidth + borderwidth: str | float = ..., # undocumented class_: str = "", compound: _TtkCompound = "", cursor: tkinter._Cursor = "", font: _FontDescription = ..., foreground: str = "", - image: tkinter._ImageSpec = "", + image: tkinter._Image | str = "", justify: Literal["left", "center", "right"] = ..., name: str = ..., padding: _Padding = ..., - relief: tkinter._Relief = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., state: str = "normal", style: str = "", - takefocus: tkinter._TakeFocusValue = "", + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", text: float | str = "", textvariable: tkinter.Variable = ..., underline: int = -1, width: int | Literal[""] = "", - wraplength: tkinter._ScreenUnits = ..., + wraplength: str | float = ..., ) -> None: ... @overload def configure( self, cnf: dict[str, Any] | None = None, *, - anchor: tkinter._Anchor = ..., + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., background: str = ..., - border: tkinter._ScreenUnits = ..., - borderwidth: tkinter._ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., compound: _TtkCompound = ..., cursor: tkinter._Cursor = ..., font: _FontDescription = ..., foreground: str = ..., - image: tkinter._ImageSpec = ..., + image: tkinter._Image | str = ..., justify: Literal["left", "center", "right"] = ..., padding: _Padding = ..., - relief: tkinter._Relief = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., state: str = ..., style: str = ..., - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = ..., textvariable: tkinter.Variable = ..., underline: int = ..., width: int | Literal[""] = ..., - wraplength: tkinter._ScreenUnits = ..., + wraplength: str | float = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -569,40 +570,40 @@ class Labelframe(Widget): self, master: tkinter.Misc | None = None, *, - border: tkinter._ScreenUnits = ..., - borderwidth: tkinter._ScreenUnits = ..., # undocumented + border: str | float = ..., + borderwidth: str | float = ..., # undocumented class_: str = "", cursor: tkinter._Cursor = "", - height: tkinter._ScreenUnits = 0, + height: str | float = 0, labelanchor: Literal["nw", "n", "ne", "en", "e", "es", "se", "s", "sw", "ws", "w", "wn"] = ..., labelwidget: tkinter.Misc = ..., name: str = ..., padding: _Padding = ..., - relief: tkinter._Relief = ..., # undocumented + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., # undocumented style: str = "", - takefocus: tkinter._TakeFocusValue = "", + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", text: float | str = "", underline: int = -1, - width: tkinter._ScreenUnits = 0, + width: str | float = 0, ) -> None: ... @overload def configure( self, cnf: dict[str, Any] | None = None, *, - border: tkinter._ScreenUnits = ..., - borderwidth: tkinter._ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., cursor: tkinter._Cursor = ..., - height: tkinter._ScreenUnits = ..., + height: str | float = ..., labelanchor: Literal["nw", "n", "ne", "en", "e", "es", "se", "s", "sw", "ws", "w", "wn"] = ..., labelwidget: tkinter.Misc = ..., padding: _Padding = ..., - relief: tkinter._Relief = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., style: str = ..., - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = ..., underline: int = ..., - width: tkinter._ScreenUnits = ..., + width: str | float = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -619,13 +620,13 @@ class Menubutton(Widget): compound: _TtkCompound = "", cursor: tkinter._Cursor = "", direction: Literal["above", "below", "left", "right", "flush"] = "below", - image: tkinter._ImageSpec = "", + image: tkinter._Image | str = "", menu: tkinter.Menu = ..., name: str = ..., padding=..., # undocumented state: str = "normal", style: str = "", - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = "", textvariable: tkinter.Variable = ..., underline: int = -1, @@ -639,12 +640,12 @@ class Menubutton(Widget): compound: _TtkCompound = ..., cursor: tkinter._Cursor = ..., direction: Literal["above", "below", "left", "right", "flush"] = ..., - image: tkinter._ImageSpec = ..., + image: tkinter._Image | str = ..., menu: tkinter.Menu = ..., padding=..., state: str = ..., style: str = ..., - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = ..., textvariable: tkinter.Variable = ..., underline: int = ..., @@ -665,7 +666,7 @@ class Notebook(Widget): name: str = ..., padding: _Padding = ..., style: str = "", - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., width: int = 0, ) -> None: ... @overload @@ -677,7 +678,7 @@ class Notebook(Widget): height: int = ..., padding: _Padding = ..., style: str = ..., - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., width: int = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload @@ -694,7 +695,7 @@ class Notebook(Widget): # `image` is a sequence of an image name, followed by zero or more # (sequences of one or more state names followed by an image name) image=..., - compound: tkinter._Compound = ..., + compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., underline: int = ..., ) -> None: ... def forget(self, tab_id) -> None: ... # type: ignore[override] @@ -719,7 +720,7 @@ class Panedwindow(Widget, tkinter.PanedWindow): name: str = ..., orient: Literal["vertical", "horizontal"] = "vertical", # can't be changed with configure() style: str = "", - takefocus: tkinter._TakeFocusValue = "", + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", width: int = 0, ) -> None: ... def add(self, child: tkinter.Widget, *, weight: int = ..., **kw) -> None: ... @@ -731,7 +732,7 @@ class Panedwindow(Widget, tkinter.PanedWindow): cursor: tkinter._Cursor = ..., height: int = ..., style: str = ..., - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., width: int = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload @@ -745,7 +746,7 @@ class Panedwindow(Widget, tkinter.PanedWindow): cursor: tkinter._Cursor = ..., height: int = ..., style: str = ..., - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., width: int = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload @@ -764,14 +765,14 @@ class Progressbar(Widget): *, class_: str = "", cursor: tkinter._Cursor = "", - length: tkinter._ScreenUnits = 100, + length: str | float = 100, maximum: float = 100, mode: Literal["determinate", "indeterminate"] = "determinate", name: str = ..., orient: Literal["horizontal", "vertical"] = "horizontal", phase: int = 0, # docs say read-only but assigning int to this works style: str = "", - takefocus: tkinter._TakeFocusValue = "", + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", value: float = 0.0, variable: tkinter.IntVar | tkinter.DoubleVar = ..., ) -> None: ... @@ -781,13 +782,13 @@ class Progressbar(Widget): cnf: dict[str, Any] | None = None, *, cursor: tkinter._Cursor = ..., - length: tkinter._ScreenUnits = ..., + length: str | float = ..., maximum: float = ..., mode: Literal["determinate", "indeterminate"] = ..., orient: Literal["horizontal", "vertical"] = ..., phase: int = ..., style: str = ..., - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., value: float = ..., variable: tkinter.IntVar | tkinter.DoubleVar = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @@ -804,15 +805,15 @@ class Radiobutton(Widget): master: tkinter.Misc | None = None, *, class_: str = "", - command: tkinter._ButtonCommand = "", + command: str | Callable[[], Any] = "", compound: _TtkCompound = "", cursor: tkinter._Cursor = "", - image: tkinter._ImageSpec = "", + image: tkinter._Image | str = "", name: str = ..., padding=..., # undocumented state: str = "normal", style: str = "", - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = "", textvariable: tkinter.Variable = ..., underline: int = -1, @@ -825,14 +826,14 @@ class Radiobutton(Widget): self, cnf: dict[str, Any] | None = None, *, - command: tkinter._ButtonCommand = ..., + command: str | Callable[[], Any] = ..., compound: _TtkCompound = ..., cursor: tkinter._Cursor = ..., - image: tkinter._ImageSpec = ..., + image: tkinter._Image | str = ..., padding=..., state: str = ..., style: str = ..., - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = ..., textvariable: tkinter.Variable = ..., underline: int = ..., @@ -855,12 +856,12 @@ class Scale(Widget, tkinter.Scale): # type: ignore[misc] command: str | Callable[[str], object] = "", cursor: tkinter._Cursor = "", from_: float = 0, - length: tkinter._ScreenUnits = 100, + length: str | float = 100, name: str = ..., orient: Literal["horizontal", "vertical"] = "horizontal", state: str = ..., # undocumented style: str = "", - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., to: float = 1.0, value: float = 0, variable: tkinter.IntVar | tkinter.DoubleVar = ..., @@ -873,11 +874,11 @@ class Scale(Widget, tkinter.Scale): # type: ignore[misc] command: str | Callable[[str], object] = ..., cursor: tkinter._Cursor = ..., from_: float = ..., - length: tkinter._ScreenUnits = ..., + length: str | float = ..., orient: Literal["horizontal", "vertical"] = ..., state: str = ..., style: str = ..., - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., to: float = ..., value: float = ..., variable: tkinter.IntVar | tkinter.DoubleVar = ..., @@ -893,11 +894,11 @@ class Scale(Widget, tkinter.Scale): # type: ignore[misc] command: str | Callable[[str], object] = ..., cursor: tkinter._Cursor = ..., from_: float = ..., - length: tkinter._ScreenUnits = ..., + length: str | float = ..., orient: Literal["horizontal", "vertical"] = ..., state: str = ..., style: str = ..., - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., to: float = ..., value: float = ..., variable: tkinter.IntVar | tkinter.DoubleVar = ..., @@ -918,7 +919,7 @@ class Scrollbar(Widget, tkinter.Scrollbar): # type: ignore[misc] name: str = ..., orient: Literal["horizontal", "vertical"] = "vertical", style: str = "", - takefocus: tkinter._TakeFocusValue = "", + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", ) -> None: ... @overload # type: ignore[override] def configure( @@ -929,7 +930,7 @@ class Scrollbar(Widget, tkinter.Scrollbar): # type: ignore[misc] cursor: tkinter._Cursor = ..., orient: Literal["horizontal", "vertical"] = ..., style: str = ..., - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -943,7 +944,7 @@ class Scrollbar(Widget, tkinter.Scrollbar): # type: ignore[misc] cursor: tkinter._Cursor = ..., orient: Literal["horizontal", "vertical"] = ..., style: str = ..., - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def config(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -958,7 +959,7 @@ class Separator(Widget): name: str = ..., orient: Literal["horizontal", "vertical"] = "horizontal", style: str = "", - takefocus: tkinter._TakeFocusValue = "", + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", ) -> None: ... @overload def configure( @@ -968,7 +969,7 @@ class Separator(Widget): cursor: tkinter._Cursor = ..., orient: Literal["horizontal", "vertical"] = ..., style: str = ..., - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -983,7 +984,7 @@ class Sizegrip(Widget): cursor: tkinter._Cursor = ..., name: str = ..., style: str = "", - takefocus: tkinter._TakeFocusValue = "", + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", ) -> None: ... @overload def configure( @@ -992,7 +993,7 @@ class Sizegrip(Widget): *, cursor: tkinter._Cursor = ..., style: str = ..., - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -1013,21 +1014,21 @@ class Spinbox(Entry): format: str = "", from_: float = 0, increment: float = 1, - invalidcommand: tkinter._EntryValidateCommand = ..., # undocumented + invalidcommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., # undocumented justify: Literal["left", "center", "right"] = ..., # undocumented name: str = ..., show=..., # undocumented state: str = "normal", style: str = "", - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., textvariable: tkinter.Variable = ..., # undocumented to: float = 0, validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = "none", - validatecommand: tkinter._EntryValidateCommand = "", + validatecommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = "", values: list[str] | tuple[str, ...] = ..., width: int = ..., # undocumented wrap: bool = False, - xscrollcommand: tkinter._XYScrollCommand = "", + xscrollcommand: str | Callable[[float, float], object] = "", ) -> None: ... @overload # type: ignore[override] def configure( @@ -1043,20 +1044,20 @@ class Spinbox(Entry): format: str = ..., from_: float = ..., increment: float = ..., - invalidcommand: tkinter._EntryValidateCommand = ..., + invalidcommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., justify: Literal["left", "center", "right"] = ..., show=..., state: str = ..., style: str = ..., - takefocus: tkinter._TakeFocusValue = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., textvariable: tkinter.Variable = ..., to: float = ..., validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ..., - validatecommand: tkinter._EntryValidateCommand = ..., + validatecommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., values: list[str] | tuple[str, ...] = ..., width: int = ..., wrap: bool = ..., - xscrollcommand: tkinter._XYScrollCommand = ..., + xscrollcommand: str | Callable[[float, float], object] = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -1083,7 +1084,7 @@ class _TreeviewTagDict(TypedDict): class _TreeviewHeaderDict(TypedDict): text: str image: list[str] | Literal[""] - anchor: tkinter._Anchor + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] command: str state: str # Doesn't seem to appear anywhere else than in these dicts @@ -1092,7 +1093,7 @@ class _TreeviewColumnDict(TypedDict): width: int minwidth: int stretch: bool # actually 0 or 1 - anchor: tkinter._Anchor + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] id: str class Treeview(Widget, tkinter.XView, tkinter.YView): @@ -1114,9 +1115,9 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): # surprised if someone is using it. show: Literal["tree", "headings", "tree headings", ""] | list[str] | tuple[str, ...] = ("tree", "headings"), style: str = "", - takefocus: tkinter._TakeFocusValue = ..., - xscrollcommand: tkinter._XYScrollCommand = "", - yscrollcommand: tkinter._XYScrollCommand = "", + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., + xscrollcommand: str | Callable[[float, float], object] = "", + yscrollcommand: str | Callable[[float, float], object] = "", ) -> None: ... @overload def configure( @@ -1131,9 +1132,9 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): selectmode: Literal["extended", "browse", "none"] = ..., show: Literal["tree", "headings", "tree headings", ""] | list[str] | tuple[str, ...] = ..., style: str = ..., - takefocus: tkinter._TakeFocusValue = ..., - xscrollcommand: tkinter._XYScrollCommand = ..., - yscrollcommand: tkinter._XYScrollCommand = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., + xscrollcommand: str | Callable[[float, float], object] = ..., + yscrollcommand: str | Callable[[float, float], object] = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -1160,7 +1161,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): width: int = ..., minwidth: int = ..., stretch: bool = ..., - anchor: tkinter._Anchor = ..., + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., # id is read-only ) -> _TreeviewColumnDict | None: ... def delete(self, *items: str | int) -> None: ... @@ -1189,8 +1190,8 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): option: None = None, *, text: str = ..., - image: tkinter._ImageSpec = ..., - anchor: tkinter._Anchor = ..., + image: tkinter._Image | str = ..., + anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., command: str | Callable[[], object] = ..., ) -> None: ... # Internal Method. Leave untyped: @@ -1208,7 +1209,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): *, id: str | int = ..., # same as iid text: str = ..., - image: tkinter._ImageSpec = ..., + image: tkinter._Image | str = ..., values: list[Any] | tuple[Any, ...] = ..., open: bool = ..., tags: str | list[str] | tuple[str, ...] = ..., @@ -1234,7 +1235,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): option: None = None, *, text: str = ..., - image: tkinter._ImageSpec = ..., + image: tkinter._Image | str = ..., values: list[Any] | tuple[Any, ...] | Literal[""] = ..., open: bool = ..., tags: str | list[str] | tuple[str, ...] = ..., @@ -1294,7 +1295,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): foreground: str = ..., background: str = ..., font: _FontDescription = ..., - image: tkinter._ImageSpec = ..., + image: tkinter._Image | str = ..., ) -> _TreeviewTagDict | MaybeNone: ... # can be None but annoying to check @overload def tag_has(self, tagname: str, item: None = None) -> tuple[str, ...]: ... @@ -1313,18 +1314,18 @@ class LabeledScale(Frame): from_: float = 0, to: float = 10, *, - border: tkinter._ScreenUnits = ..., - borderwidth: tkinter._ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., class_: str = "", compound: Literal["top", "bottom"] = "top", cursor: tkinter._Cursor = "", - height: tkinter._ScreenUnits = 0, + height: str | float = 0, name: str = ..., padding: _Padding = ..., - relief: tkinter._Relief = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., style: str = "", - takefocus: tkinter._TakeFocusValue = "", - width: tkinter._ScreenUnits = 0, + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", + width: str | float = 0, ) -> None: ... # destroy is overridden, signature does not change value: Any diff --git a/stubs/ttkthemes/ttkthemes/themed_tk.pyi b/stubs/ttkthemes/ttkthemes/themed_tk.pyi index 5b826ad71b3b..64852728172c 100644 --- a/stubs/ttkthemes/ttkthemes/themed_tk.pyi +++ b/stubs/ttkthemes/ttkthemes/themed_tk.pyi @@ -1,5 +1,6 @@ import tkinter -from typing import Any +from collections.abc import Callable +from typing import Any, Literal from ._widget import ThemedWidget @@ -31,21 +32,21 @@ class ThemedTk(tkinter.Tk, ThemedWidget): toplevel: bool | None = ..., theme: str | None = ..., background: str = ..., - bd: tkinter._ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., - border: tkinter._ScreenUnits = ..., - borderwidth: tkinter._ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., cursor: tkinter._Cursor = ..., - height: tkinter._ScreenUnits = ..., + height: str | float = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: tkinter._ScreenUnits = ..., + highlightthickness: str | float = ..., menu: tkinter.Menu = ..., - padx: tkinter._ScreenUnits = ..., - pady: tkinter._ScreenUnits = ..., - relief: tkinter._Relief = ..., - takefocus: tkinter._TakeFocusValue = ..., - width: tkinter._ScreenUnits = ..., + padx: str | float = ..., + pady: str | float = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., + width: str | float = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... def cget(self, k: str) -> Any: ... def configure( # type: ignore[override] @@ -56,21 +57,21 @@ class ThemedTk(tkinter.Tk, ThemedWidget): toplevel: bool | None = ..., theme: str | None = ..., background: str = ..., - bd: tkinter._ScreenUnits = ..., + bd: str | float = ..., bg: str = ..., - border: tkinter._ScreenUnits = ..., - borderwidth: tkinter._ScreenUnits = ..., + border: str | float = ..., + borderwidth: str | float = ..., cursor: tkinter._Cursor = ..., - height: tkinter._ScreenUnits = ..., + height: str | float = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: tkinter._ScreenUnits = ..., + highlightthickness: str | float = ..., menu: tkinter.Menu = ..., - padx: tkinter._ScreenUnits = ..., - pady: tkinter._ScreenUnits = ..., - relief: tkinter._Relief = ..., - takefocus: tkinter._TakeFocusValue = ..., - width: tkinter._ScreenUnits = ..., + padx: str | float = ..., + pady: str | float = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., + width: str | float = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... def __getitem__(self, k: str) -> Any: ... def __setitem__(self, k: str, v: Any) -> None: ... From 2278669cf61cf75e5190aa3e844d1d2c2510c9a7 Mon Sep 17 00:00:00 2001 From: donBarbos Date: Thu, 18 Sep 2025 23:12:06 +0400 Subject: [PATCH 2/4] Apply suggestions --- stdlib/tkinter/__init__.pyi | 876 ++++++++++++------------ stdlib/tkinter/ttk.pyi | 90 +-- stubs/ttkthemes/ttkthemes/themed_tk.pyi | 32 +- 3 files changed, 499 insertions(+), 499 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index c500aa3e92e8..456fe789f57b 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -366,8 +366,8 @@ _Ts = TypeVarTuple("_Ts") @type_check_only class _GridIndexInfo(TypedDict, total=False): - minsize: str | float - pad: str | float + minsize: float | str + pad: float | str uniform: str | None weight: int @@ -466,7 +466,7 @@ class Misc: def winfo_containing(self, rootX: int, rootY: int, displayof: Literal[0] | Misc | None = 0) -> Misc | None: ... def winfo_depth(self) -> int: ... def winfo_exists(self) -> bool: ... - def winfo_fpixels(self, number: str | float) -> float: ... + def winfo_fpixels(self, number: float | str) -> float: ... def winfo_geometry(self) -> str: ... def winfo_height(self) -> int: ... def winfo_id(self) -> int: ... @@ -476,7 +476,7 @@ class Misc: def winfo_name(self) -> str: ... def winfo_parent(self) -> str: ... # return value needs nametowidget() def winfo_pathname(self, id: int, displayof: Literal[0] | Misc | None = 0): ... - def winfo_pixels(self, number: str | float) -> int: ... + def winfo_pixels(self, number: float | str) -> int: ... def winfo_pointerx(self) -> int: ... def winfo_pointerxy(self) -> tuple[int, int]: ... def winfo_pointery(self) -> int: ... @@ -583,8 +583,8 @@ class Misc: index: int | str | list[int] | tuple[int, ...], cnf: _GridIndexInfo = {}, *, - minsize: str | float = ..., - pad: str | float = ..., + minsize: float | str = ..., + pad: float | str = ..., uniform: str = ..., weight: int = ..., ) -> _GridIndexInfo | MaybeNone: ... # can be None but annoying to check @@ -593,14 +593,14 @@ class Misc: index: int | str | list[int] | tuple[int, ...], cnf: _GridIndexInfo = {}, *, - minsize: str | float = ..., - pad: str | float = ..., + minsize: float | str = ..., + pad: float | str = ..., uniform: str = ..., weight: int = ..., ) -> _GridIndexInfo | MaybeNone: ... # can be None but annoying to check columnconfigure = grid_columnconfigure rowconfigure = grid_rowconfigure - def grid_location(self, x: str | float, y: str | float) -> tuple[int, int]: ... + def grid_location(self, x: float | str, y: float | str) -> tuple[int, int]: ... @overload def grid_propagate(self, flag: bool) -> None: ... @overload @@ -619,32 +619,32 @@ class Misc: sequence: str, *, above: Misc | int = ..., - borderwidth: str | float = ..., + borderwidth: float | str = ..., button: int = ..., count: int = ..., data: Any = ..., # anything with usable str() value delta: int = ..., detail: str = ..., focus: bool = ..., - height: str | float = ..., + height: float | str = ..., keycode: int = ..., keysym: str = ..., mode: str = ..., override: bool = ..., place: Literal["PlaceOnTop", "PlaceOnBottom"] = ..., root: Misc | int = ..., - rootx: str | float = ..., - rooty: str | float = ..., + rootx: float | str = ..., + rooty: float | str = ..., sendevent: bool = ..., serial: int = ..., state: int | str = ..., subwindow: Misc | int = ..., time: int = ..., warp: bool = ..., - width: str | float = ..., + width: float | str = ..., when: Literal["now", "tail", "head", "mark"] = ..., - x: str | float = ..., - y: str | float = ..., + x: float | str = ..., + y: float | str = ..., ) -> None: ... def event_info(self, virtual: str | None = None) -> tuple[str, ...]: ... def image_names(self) -> tuple[str, ...]: ... @@ -673,7 +673,7 @@ class XView: @overload def xview_scroll(self, number: int, what: Literal["units", "pages"]) -> None: ... @overload - def xview_scroll(self, number: str | float, what: Literal["pixels"]) -> None: ... + def xview_scroll(self, number: float | str, what: Literal["pixels"]) -> None: ... class YView: @overload @@ -684,7 +684,7 @@ class YView: @overload def yview_scroll(self, number: int, what: Literal["units", "pages"]) -> None: ... @overload - def yview_scroll(self, number: str | float, what: Literal["pixels"]) -> None: ... + def yview_scroll(self, number: float | str, what: Literal["pixels"]) -> None: ... if sys.platform == "darwin": @type_check_only @@ -980,21 +980,21 @@ class Tk(Misc, Wm): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., cursor: _Cursor = ..., - height: str | float = ..., + height: float | str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: float | str = ..., menu: Menu = ..., - padx: str | float = ..., - pady: str | float = ..., + padx: float | str = ..., + pady: float | str = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., - width: str | float = ..., + width: float | str = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -1047,7 +1047,7 @@ class _PackInfo(_InMiscTotal): expand: bool fill: Literal["none", "x", "y", "both"] side: Literal["left", "right", "top", "bottom"] - # Paddings come out as int or tuple of int, even though any str or float + # Paddings come out as int or tuple of int, even though any screen units # can be specified in pack(). ipadx: int ipady: int @@ -1056,7 +1056,7 @@ class _PackInfo(_InMiscTotal): class Pack: # _PackInfo is not the valid type for cnf because pad stuff accepts any - # str or float instead of int only. I didn't bother to create another + # screen units instead of int only. I didn't bother to create another # TypedDict for cnf because it appears to be a legacy thing that was # replaced by **kwargs. def pack_configure( @@ -1069,10 +1069,10 @@ class Pack: expand: bool | Literal[0, 1] = 0, fill: Literal["none", "x", "y", "both"] = ..., side: Literal["left", "right", "top", "bottom"] = ..., - ipadx: str | float = ..., - ipady: str | float = ..., - padx: str | float | tuple[str | float, str | float] = ..., - pady: str | float | tuple[str | float, str | float] = ..., + ipadx: float | str = ..., + ipady: float | str = ..., + padx: float | str | tuple[float | str, float | str] = ..., + pady: float | str | tuple[float | str, float | str] = ..., in_: Misc = ..., **kw: Any, # allow keyword argument named 'in', see #4836 ) -> None: ... @@ -1102,10 +1102,10 @@ class Place: *, anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., bordermode: Literal["inside", "outside", "ignore"] = ..., - width: str | float = ..., - height: str | float = ..., - x: str | float = ..., - y: str | float = ..., + width: float | str = ..., + height: float | str = ..., + x: float | str = ..., + y: float | str = ..., # str allowed for compatibility with place_info() relheight: str | float = ..., relwidth: str | float = ..., @@ -1140,10 +1140,10 @@ class Grid: columnspan: int = ..., row: int = ..., rowspan: int = ..., - ipadx: str | float = ..., - ipady: str | float = ..., - padx: str | float | tuple[str | float, str | float] = ..., - pady: str | float | tuple[str | float, str | float] = ..., + ipadx: float | str = ..., + ipady: float | str = ..., + padx: float | str | tuple[float | str, float | str] = ..., + pady: float | str | tuple[float | str, float | str] = ..., sticky: str = ..., # consists of letters 'n', 's', 'w', 'e', may contain repeats, may be empty in_: Misc = ..., **kw: Any, # allow keyword argument named 'in', see #4836 @@ -1188,28 +1188,28 @@ class Toplevel(BaseWidget, Wm): cnf: dict[str, Any] | None = {}, *, background: str = ..., - bd: str | float = 0, + bd: float | str = 0, bg: str = ..., - border: str | float = 0, - borderwidth: str | float = 0, + border: float | str = 0, + borderwidth: float | str = 0, class_: str = "Toplevel", colormap: Literal["new", ""] | Misc = "", container: bool = False, cursor: _Cursor = "", - height: str | float = 0, + height: float | str = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = 0, + highlightthickness: float | str = 0, menu: Menu = ..., name: str = ..., - padx: str | float = 0, - pady: str | float = 0, + padx: float | str = 0, + pady: float | str = 0, relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", screen: str = "", # can't be changed after creating widget takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = 0, use: int = ..., visual: str | tuple[str, int] = "", - width: str | float = 0, + width: float | str = 0, ) -> None: ... @overload def configure( @@ -1217,21 +1217,21 @@ class Toplevel(BaseWidget, Wm): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., cursor: _Cursor = ..., - height: str | float = ..., + height: float | str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: float | str = ..., menu: Menu = ..., - padx: str | float = ..., - pady: str | float = ..., + padx: float | str = ..., + pady: float | str = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., - width: str | float = ..., + width: float | str = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -1247,11 +1247,11 @@ class Button(Widget): activeforeground: str = ..., anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = "center", background: str = ..., - bd: str | float = ..., # same as borderwidth + bd: float | str = ..., # same as borderwidth bg: str = ..., # same as background bitmap: str = "", - border: str | float = ..., # same as borderwidth - borderwidth: str | float = ..., + border: float | str = ..., # same as borderwidth + borderwidth: float | str = ..., command: str | Callable[[], Any] = "", compound: Literal["top", "left", "center", "right", "bottom", "none"] = "none", cursor: _Cursor = "", @@ -1261,17 +1261,17 @@ class Button(Widget): font: _FontDescription = "TkDefaultFont", foreground: str = ..., # width and height must be int for buttons containing just text, but - # ints are also valid ScreenUnits is str or float - height: str | float = 0, + # buttons with an image accept any screen units. + height: float | str = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = 1, + highlightthickness: float | str = 1, image: _Image | str = "", justify: Literal["left", "center", "right"] = "center", name: str = ..., overrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove", ""] = "", - padx: str | float = ..., - pady: str | float = ..., + padx: float | str = ..., + pady: float | str = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., repeatdelay: int = ..., repeatinterval: int = ..., @@ -1283,8 +1283,8 @@ class Button(Widget): # of an IntVar. textvariable: Variable = ..., underline: int = -1, - width: str | float = 0, - wraplength: str | float = 0, + width: float | str = 0, + wraplength: float | str = 0, ) -> None: ... @overload def configure( @@ -1295,11 +1295,11 @@ class Button(Widget): activeforeground: str = ..., anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., bitmap: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., command: str | Callable[[], Any] = ..., compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., cursor: _Cursor = ..., @@ -1308,15 +1308,15 @@ class Button(Widget): fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: str | float = ..., + height: float | str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: float | str = ..., image: _Image | str = ..., justify: Literal["left", "center", "right"] = ..., overrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove", ""] = ..., - padx: str | float = ..., - pady: str | float = ..., + padx: float | str = ..., + pady: float | str = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., repeatdelay: int = ..., repeatinterval: int = ..., @@ -1325,8 +1325,8 @@ class Button(Widget): text: float | str = ..., textvariable: Variable = ..., underline: int = ..., - width: str | float = ..., - wraplength: str | float = ..., + width: float | str = ..., + wraplength: float | str = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -1341,41 +1341,41 @@ class Canvas(Widget, XView, YView): cnf: dict[str, Any] | None = {}, *, background: str = ..., - bd: str | float = 0, + bd: float | str = 0, bg: str = ..., - border: str | float = 0, - borderwidth: str | float = 0, + border: float | str = 0, + borderwidth: float | str = 0, closeenough: float = 1.0, confine: bool = True, cursor: _Cursor = "", # canvas manual page has a section named COORDINATES, and the first # part of it describes str or float type. - height: str | float = ..., + height: float | str = ..., # see COORDINATES in canvas manual page highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: float | str = ..., insertbackground: str = ..., - insertborderwidth: str | float = 0, + insertborderwidth: float | str = 0, insertofftime: int = 300, insertontime: int = 600, - insertwidth: str | float = 2, + insertwidth: float | str = 2, name: str = ..., offset=..., # undocumented relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", # Setting scrollregion to None doesn't reset it back to empty, # but setting it to () does. - scrollregion: tuple[str | float, str | float, str | float, str | float] | tuple[()] = (), + scrollregion: tuple[float | str, float | str, float | str, float | str] | tuple[()] = (), selectbackground: str = ..., - selectborderwidth: str | float = 1, + selectborderwidth: float | str = 1, selectforeground: str = ..., # man page says that state can be 'hidden', but it can't state: Literal["normal", "disabled"] = "normal", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", - width: str | float = ..., + width: float | str = ..., xscrollcommand: str | Callable[[float, float], object] = "", - xscrollincrement: str | float = 0, + xscrollincrement: float | str = 0, yscrollcommand: str | Callable[[float, float], object] = "", - yscrollincrement: str | float = 0, + yscrollincrement: float | str = 0, ) -> None: ... @overload def configure( @@ -1383,35 +1383,35 @@ class Canvas(Widget, XView, YView): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., closeenough: float = ..., confine: bool = ..., cursor: _Cursor = ..., - height: str | float = ..., + height: float | str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: float | str = ..., insertbackground: str = ..., - insertborderwidth: str | float = ..., + insertborderwidth: float | str = ..., insertofftime: int = ..., insertontime: int = ..., - insertwidth: str | float = ..., + insertwidth: float | str = ..., offset=..., # undocumented relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., - scrollregion: tuple[str | float, str | float, str | float, str | float] | tuple[()] = ..., + scrollregion: tuple[float | str, float | str, float | str, float | str] | tuple[()] = ..., selectbackground: str = ..., - selectborderwidth: str | float = ..., + selectborderwidth: float | str = ..., selectforeground: str = ..., state: Literal["normal", "disabled"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., - width: str | float = ..., + width: float | str = ..., xscrollcommand: str | Callable[[float, float], object] = ..., - xscrollincrement: str | float = ..., + xscrollincrement: float | str = ..., yscrollcommand: str | Callable[[float, float], object] = ..., - yscrollincrement: str | float = ..., + yscrollincrement: float | str = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -1421,20 +1421,20 @@ class Canvas(Widget, XView, YView): def addtag_all(self, newtag: str) -> None: ... def addtag_below(self, newtag: str, tagOrId: str | int) -> None: ... def addtag_closest( - self, newtag: str, x: str | float, y: str | float, halo: str | float | None = None, start: str | int | None = None + self, newtag: str, x: float | str, y: float | str, halo: float | str | None = None, start: str | int | None = None ) -> None: ... - def addtag_enclosed(self, newtag: str, x1: str | float, y1: str | float, x2: str | float, y2: str | float) -> None: ... - def addtag_overlapping(self, newtag: str, x1: str | float, y1: str | float, x2: str | float, y2: str | float) -> None: ... + def addtag_enclosed(self, newtag: str, x1: float | str, y1: float | str, x2: float | str, y2: float | str) -> None: ... + def addtag_overlapping(self, newtag: str, x1: float | str, y1: float | str, x2: float | str, y2: float | str) -> None: ... def addtag_withtag(self, newtag: str, tagOrId: str | int) -> None: ... def find(self, *args): ... # internal method def find_above(self, tagOrId: str | int) -> tuple[int, ...]: ... def find_all(self) -> tuple[int, ...]: ... def find_below(self, tagOrId: str | int) -> tuple[int, ...]: ... def find_closest( - self, x: str | float, y: str | float, halo: str | float | None = None, start: str | int | None = None + self, x: float | str, y: float | str, halo: float | str | None = None, start: str | int | None = None ) -> tuple[int, ...]: ... - def find_enclosed(self, x1: str | float, y1: str | float, x2: str | float, y2: str | float) -> tuple[int, ...]: ... - def find_overlapping(self, x1: str | float, y1: str | float, x2: str | float, y2: float) -> tuple[int, ...]: ... + def find_enclosed(self, x1: float | str, y1: float | str, x2: float | str, y2: float | str) -> tuple[int, ...]: ... + def find_overlapping(self, x1: float | str, y1: float | str, x2: float | str, y2: float) -> tuple[int, ...]: ... def find_withtag(self, tagOrId: str | int) -> tuple[int, ...]: ... # Incompatible with Misc.bbox(), tkinter violates LSP def bbox(self, *args: str | int) -> tuple[int, int, int, int]: ... # type: ignore[override] @@ -1479,25 +1479,25 @@ class Canvas(Widget, XView, YView): activedash: str | int | list[int] | tuple[int, ...] = ..., activefill: str = ..., activestipple: str = ..., - activewidth: str | float = ..., + activewidth: float | str = ..., arrow: Literal["first", "last", "both"] = ..., arrowshape: tuple[float, float, float] = ..., capstyle: Literal["round", "projecting", "butt"] = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: str | float = ..., + dashoffset: float | str = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledstipple: str = ..., - disabledwidth: str | float = ..., + disabledwidth: float | str = ..., fill: str = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: str | float = ..., + offset: float | str = ..., smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: float | str = ..., ) -> int: ... @overload def create_line( @@ -1509,25 +1509,25 @@ class Canvas(Widget, XView, YView): activedash: str | int | list[int] | tuple[int, ...] = ..., activefill: str = ..., activestipple: str = ..., - activewidth: str | float = ..., + activewidth: float | str = ..., arrow: Literal["first", "last", "both"] = ..., arrowshape: tuple[float, float, float] = ..., capstyle: Literal["round", "projecting", "butt"] = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: str | float = ..., + dashoffset: float | str = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledstipple: str = ..., - disabledwidth: str | float = ..., + disabledwidth: float | str = ..., fill: str = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: str | float = ..., + offset: float | str = ..., smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: float | str = ..., ) -> int: ... @overload def create_line( @@ -1545,25 +1545,25 @@ class Canvas(Widget, XView, YView): activedash: str | int | list[int] | tuple[int, ...] = ..., activefill: str = ..., activestipple: str = ..., - activewidth: str | float = ..., + activewidth: float | str = ..., arrow: Literal["first", "last", "both"] = ..., arrowshape: tuple[float, float, float] = ..., capstyle: Literal["round", "projecting", "butt"] = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: str | float = ..., + dashoffset: float | str = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledstipple: str = ..., - disabledwidth: str | float = ..., + disabledwidth: float | str = ..., fill: str = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: str | float = ..., + offset: float | str = ..., smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: float | str = ..., ) -> int: ... @overload def create_oval( @@ -1579,24 +1579,24 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: str | float = ..., + activewidth: float | str = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: str | float = ..., + dashoffset: float | str = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: str | float = ..., + disabledwidth: float | str = ..., fill: str = ..., - offset: str | float = ..., + offset: float | str = ..., outline: str = ..., - outlineoffset: str | float = ..., + outlineoffset: float | str = ..., outlinestipple: str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: float | str = ..., ) -> int: ... @overload def create_oval( @@ -1610,24 +1610,24 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: str | float = ..., + activewidth: float | str = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: str | float = ..., + dashoffset: float | str = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: str | float = ..., + disabledwidth: float | str = ..., fill: str = ..., - offset: str | float = ..., + offset: float | str = ..., outline: str = ..., - outlineoffset: str | float = ..., + outlineoffset: float | str = ..., outlinestipple: str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: float | str = ..., ) -> int: ... @overload def create_oval( @@ -1647,24 +1647,24 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: str | float = ..., + activewidth: float | str = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: str | float = ..., + dashoffset: float | str = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: str | float = ..., + disabledwidth: float | str = ..., fill: str = ..., - offset: str | float = ..., + offset: float | str = ..., outline: str = ..., - outlineoffset: str | float = ..., + outlineoffset: float | str = ..., outlinestipple: str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: float | str = ..., ) -> int: ... @overload def create_polygon( @@ -1680,27 +1680,27 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: str | float = ..., + activewidth: float | str = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: str | float = ..., + dashoffset: float | str = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: str | float = ..., + disabledwidth: float | str = ..., fill: str = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: str | float = ..., + offset: float | str = ..., outline: str = ..., - outlineoffset: str | float = ..., + outlineoffset: float | str = ..., outlinestipple: str = ..., smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: float | str = ..., ) -> int: ... @overload def create_polygon( @@ -1714,27 +1714,27 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: str | float = ..., + activewidth: float | str = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: str | float = ..., + dashoffset: float | str = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: str | float = ..., + disabledwidth: float | str = ..., fill: str = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: str | float = ..., + offset: float | str = ..., outline: str = ..., - outlineoffset: str | float = ..., + outlineoffset: float | str = ..., outlinestipple: str = ..., smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: float | str = ..., ) -> int: ... @overload def create_polygon( @@ -1754,27 +1754,27 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: str | float = ..., + activewidth: float | str = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: str | float = ..., + dashoffset: float | str = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: str | float = ..., + disabledwidth: float | str = ..., fill: str = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: str | float = ..., + offset: float | str = ..., outline: str = ..., - outlineoffset: str | float = ..., + outlineoffset: float | str = ..., outlinestipple: str = ..., smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: float | str = ..., ) -> int: ... @overload def create_rectangle( @@ -1790,24 +1790,24 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: str | float = ..., + activewidth: float | str = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: str | float = ..., + dashoffset: float | str = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: str | float = ..., + disabledwidth: float | str = ..., fill: str = ..., - offset: str | float = ..., + offset: float | str = ..., outline: str = ..., - outlineoffset: str | float = ..., + outlineoffset: float | str = ..., outlinestipple: str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: float | str = ..., ) -> int: ... @overload def create_rectangle( @@ -1821,24 +1821,24 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: str | float = ..., + activewidth: float | str = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: str | float = ..., + dashoffset: float | str = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: str | float = ..., + disabledwidth: float | str = ..., fill: str = ..., - offset: str | float = ..., + offset: float | str = ..., outline: str = ..., - outlineoffset: str | float = ..., + outlineoffset: float | str = ..., outlinestipple: str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: float | str = ..., ) -> int: ... @overload def create_rectangle( @@ -1858,24 +1858,24 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: str | float = ..., + activewidth: float | str = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: str | float = ..., + dashoffset: float | str = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: str | float = ..., + disabledwidth: float | str = ..., fill: str = ..., - offset: str | float = ..., + offset: float | str = ..., outline: str = ..., - outlineoffset: str | float = ..., + outlineoffset: float | str = ..., outlinestipple: str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: float | str = ..., ) -> int: ... @overload def create_text( @@ -1893,12 +1893,12 @@ class Canvas(Widget, XView, YView): fill: str = ..., font: _FontDescription = ..., justify: Literal["left", "center", "right"] = ..., - offset: str | float = ..., + offset: float | str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., text: float | str = ..., - width: str | float = ..., + width: float | str = ..., ) -> int: ... @overload def create_text( @@ -1915,12 +1915,12 @@ class Canvas(Widget, XView, YView): fill: str = ..., font: _FontDescription = ..., justify: Literal["left", "center", "right"] = ..., - offset: str | float = ..., + offset: float | str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., text: float | str = ..., - width: str | float = ..., + width: float | str = ..., ) -> int: ... @overload def create_window( @@ -1930,10 +1930,10 @@ class Canvas(Widget, XView, YView): /, *, anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., - height: str | float = ..., + height: float | str = ..., state: Literal["normal", "hidden", "disabled"] = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: float | str = ..., window: Widget = ..., ) -> int: ... @overload @@ -1943,10 +1943,10 @@ class Canvas(Widget, XView, YView): /, *, anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., - height: str | float = ..., + height: float | str = ..., state: Literal["normal", "hidden", "disabled"] = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: float | str = ..., window: Widget = ..., ) -> int: ... def dchars(self, *args) -> None: ... @@ -1979,7 +1979,7 @@ class Canvas(Widget, XView, YView): def tag_raise(self, first: str | int, second: str | int | None = ..., /) -> None: ... def tkraise(self, first: str | int, second: str | int | None = ..., /) -> None: ... # type: ignore[override] def lift(self, first: str | int, second: str | int | None = ..., /) -> None: ... # type: ignore[override] - def scale(self, tagOrId: str | int, xOrigin: str | float, yOrigin: str | float, xScale: float, yScale: float, /) -> None: ... + def scale(self, tagOrId: str | int, xOrigin: float | str, yOrigin: float | str, xScale: float, yScale: float, /) -> None: ... def scan_mark(self, x, y) -> None: ... def scan_dragto(self, x, y, gain: int = 10) -> None: ... def select_adjust(self, tagOrId, index) -> None: ... @@ -1999,11 +1999,11 @@ class Checkbutton(Widget): activeforeground: str = ..., anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = "center", background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., bitmap: str = "", - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., command: str | Callable[[], Any] = "", compound: Literal["top", "left", "center", "right", "bottom", "none"] = "none", cursor: _Cursor = "", @@ -2011,10 +2011,10 @@ class Checkbutton(Widget): fg: str = ..., font: _FontDescription = "TkDefaultFont", foreground: str = ..., - height: str | float = 0, + height: float | str = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = 1, + highlightthickness: float | str = 1, image: _Image | str = "", indicatoron: bool = True, justify: Literal["left", "center", "right"] = "center", @@ -2033,8 +2033,8 @@ class Checkbutton(Widget): offvalue: Any = 0, onvalue: Any = 1, overrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove", ""] = "", - padx: str | float = 1, - pady: str | float = 1, + padx: float | str = 1, + pady: float | str = 1, relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", selectcolor: str = ..., selectimage: _Image | str = "", @@ -2046,8 +2046,8 @@ class Checkbutton(Widget): tristatevalue: Any = "", underline: int = -1, variable: Variable | Literal[""] = ..., - width: str | float = 0, - wraplength: str | float = 0, + width: float | str = 0, + wraplength: float | str = 0, ) -> None: ... @overload def configure( @@ -2058,11 +2058,11 @@ class Checkbutton(Widget): activeforeground: str = ..., anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., bitmap: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., command: str | Callable[[], Any] = ..., compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., cursor: _Cursor = ..., @@ -2070,10 +2070,10 @@ class Checkbutton(Widget): fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: str | float = ..., + height: float | str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: float | str = ..., image: _Image | str = ..., indicatoron: bool = ..., justify: Literal["left", "center", "right"] = ..., @@ -2081,8 +2081,8 @@ class Checkbutton(Widget): offvalue: Any = ..., onvalue: Any = ..., overrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove", ""] = ..., - padx: str | float = ..., - pady: str | float = ..., + padx: float | str = ..., + pady: float | str = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., selectcolor: str = ..., selectimage: _Image | str = ..., @@ -2094,8 +2094,8 @@ class Checkbutton(Widget): tristatevalue: Any = ..., underline: int = ..., variable: Variable | Literal[""] = ..., - width: str | float = ..., - wraplength: str | float = ..., + width: float | str = ..., + wraplength: float | str = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -2113,10 +2113,10 @@ class Entry(Widget, XView): cnf: dict[str, Any] | None = {}, *, background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., cursor: _Cursor = "xterm", disabledbackground: str = ..., disabledforeground: str = ..., @@ -2126,12 +2126,12 @@ class Entry(Widget, XView): foreground: str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: float | str = ..., insertbackground: str = ..., - insertborderwidth: str | float = 0, + insertborderwidth: float | str = 0, insertofftime: int = 300, insertontime: int = 600, - insertwidth: str | float = ..., + insertwidth: float | str = ..., invalidcommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = "", invcmd: str | list[str] | tuple[str, ...] | Callable[[], bool] = "", # same as invalidcommand justify: Literal["left", "center", "right"] = "left", @@ -2139,7 +2139,7 @@ class Entry(Widget, XView): readonlybackground: str = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "sunken", selectbackground: str = ..., - selectborderwidth: str | float = ..., + selectborderwidth: float | str = ..., selectforeground: str = ..., show: str = "", state: Literal["normal", "disabled", "readonly"] = "normal", @@ -2157,10 +2157,10 @@ class Entry(Widget, XView): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., cursor: _Cursor = ..., disabledbackground: str = ..., disabledforeground: str = ..., @@ -2170,19 +2170,19 @@ class Entry(Widget, XView): foreground: str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: float | str = ..., insertbackground: str = ..., - insertborderwidth: str | float = ..., + insertborderwidth: float | str = ..., insertofftime: int = ..., insertontime: int = ..., - insertwidth: str | float = ..., + insertwidth: float | str = ..., invalidcommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., invcmd: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., justify: Literal["left", "center", "right"] = ..., readonlybackground: str = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., selectbackground: str = ..., - selectborderwidth: str | float = ..., + selectborderwidth: float | str = ..., selectforeground: str = ..., show: str = ..., state: Literal["normal", "disabled", "readonly"] = ..., @@ -2224,25 +2224,25 @@ class Frame(Widget): cnf: dict[str, Any] | None = {}, *, background: str = ..., - bd: str | float = 0, + bd: float | str = 0, bg: str = ..., - border: str | float = 0, - borderwidth: str | float = 0, + border: float | str = 0, + borderwidth: float | str = 0, class_: str = "Frame", # can't be changed with configure() colormap: Literal["new", ""] | Misc = "", # can't be changed with configure() container: bool = False, # can't be changed with configure() cursor: _Cursor = "", - height: str | float = 0, + height: float | str = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = 0, + highlightthickness: float | str = 0, name: str = ..., - padx: str | float = 0, - pady: str | float = 0, + padx: float | str = 0, + pady: float | str = 0, relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = 0, visual: str | tuple[str, int] = "", # can't be changed with configure() - width: str | float = 0, + width: float | str = 0, ) -> None: ... @overload def configure( @@ -2250,20 +2250,20 @@ class Frame(Widget): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., cursor: _Cursor = ..., - height: str | float = ..., + height: float | str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., - padx: str | float = ..., - pady: str | float = ..., + highlightthickness: float | str = ..., + padx: float | str = ..., + pady: float | str = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., - width: str | float = ..., + width: float | str = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -2279,34 +2279,34 @@ class Label(Widget): activeforeground: str = ..., anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = "center", background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., bitmap: str = "", - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., compound: Literal["top", "left", "center", "right", "bottom", "none"] = "none", cursor: _Cursor = "", disabledforeground: str = ..., fg: str = ..., font: _FontDescription = "TkDefaultFont", foreground: str = ..., - height: str | float = 0, + height: float | str = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = 0, + highlightthickness: float | str = 0, image: _Image | str = "", justify: Literal["left", "center", "right"] = "center", name: str = ..., - padx: str | float = 1, - pady: str | float = 1, + padx: float | str = 1, + pady: float | str = 1, relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", state: Literal["normal", "active", "disabled"] = "normal", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = 0, text: float | str = "", textvariable: Variable = ..., underline: int = -1, - width: str | float = 0, - wraplength: str | float = 0, + width: float | str = 0, + wraplength: float | str = 0, ) -> None: ... @overload def configure( @@ -2317,33 +2317,33 @@ class Label(Widget): activeforeground: str = ..., anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., bitmap: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., cursor: _Cursor = ..., disabledforeground: str = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: str | float = ..., + height: float | str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: float | str = ..., image: _Image | str = ..., justify: Literal["left", "center", "right"] = ..., - padx: str | float = ..., - pady: str | float = ..., + padx: float | str = ..., + pady: float | str = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., state: Literal["normal", "active", "disabled"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = ..., textvariable: Variable = ..., underline: int = ..., - width: str | float = ..., - wraplength: str | float = ..., + width: float | str = ..., + wraplength: float | str = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -2357,10 +2357,10 @@ class Listbox(Widget, XView, YView): *, activestyle: Literal["dotbox", "none", "underline"] = ..., background: str = ..., - bd: str | float = 1, + bd: float | str = 1, bg: str = ..., - border: str | float = 1, - borderwidth: str | float = 1, + border: float | str = 1, + borderwidth: float | str = 1, cursor: _Cursor = "", disabledforeground: str = ..., exportselection: bool | Literal[0, 1] = 1, @@ -2370,7 +2370,7 @@ class Listbox(Widget, XView, YView): height: int = 10, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: float | str = ..., justify: Literal["left", "center", "right"] = "left", # There's no tkinter.ListVar, but seems like bare tkinter.Variable # actually works for this: @@ -2385,7 +2385,7 @@ class Listbox(Widget, XView, YView): name: str = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., selectbackground: str = ..., - selectborderwidth: str | float = 0, + selectborderwidth: float | str = 0, selectforeground: str = ..., # from listbox man page: "The value of the [selectmode] option may be # arbitrary, but the default bindings expect it to be either single, @@ -2408,10 +2408,10 @@ class Listbox(Widget, XView, YView): *, activestyle: Literal["dotbox", "none", "underline"] = ..., background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., cursor: _Cursor = ..., disabledforeground: str = ..., exportselection: bool = ..., @@ -2421,12 +2421,12 @@ class Listbox(Widget, XView, YView): height: int = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: float | str = ..., justify: Literal["left", "center", "right"] = ..., listvariable: Variable = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., selectbackground: str = ..., - selectborderwidth: str | float = ..., + selectborderwidth: float | str = ..., selectforeground: str = ..., selectmode: str | Literal["single", "browse", "multiple", "extended"] = ..., # noqa: Y051 setgrid: bool = ..., @@ -2470,13 +2470,13 @@ class Menu(Widget): cnf: dict[str, Any] | None = {}, *, activebackground: str = ..., - activeborderwidth: str | float = ..., + activeborderwidth: float | str = ..., activeforeground: str = ..., background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., cursor: _Cursor = "arrow", disabledforeground: str = ..., fg: str = ..., @@ -2501,13 +2501,13 @@ class Menu(Widget): cnf: dict[str, Any] | None = None, *, activebackground: str = ..., - activeborderwidth: str | float = ..., + activeborderwidth: float | str = ..., activeforeground: str = ..., background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., cursor: _Cursor = ..., disabledforeground: str = ..., fg: str = ..., @@ -2743,11 +2743,11 @@ class Menubutton(Widget): activeforeground: str = ..., anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., bitmap: str = "", - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., compound: Literal["top", "left", "center", "right", "bottom", "none"] = "none", cursor: _Cursor = "", direction: Literal["above", "below", "left", "right", "flush"] = "below", @@ -2755,25 +2755,25 @@ class Menubutton(Widget): fg: str = ..., font: _FontDescription = "TkDefaultFont", foreground: str = ..., - height: str | float = 0, + height: float | str = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = 0, + highlightthickness: float | str = 0, image: _Image | str = "", indicatoron: bool = ..., justify: Literal["left", "center", "right"] = ..., menu: Menu = ..., name: str = ..., - padx: str | float = ..., - pady: str | float = ..., + padx: float | str = ..., + pady: float | str = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", state: Literal["normal", "active", "disabled"] = "normal", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = 0, text: float | str = "", textvariable: Variable = ..., underline: int = -1, - width: str | float = 0, - wraplength: str | float = 0, + width: float | str = 0, + wraplength: float | str = 0, ) -> None: ... @overload def configure( @@ -2784,11 +2784,11 @@ class Menubutton(Widget): activeforeground: str = ..., anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., bitmap: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., cursor: _Cursor = ..., direction: Literal["above", "below", "left", "right", "flush"] = ..., @@ -2796,24 +2796,24 @@ class Menubutton(Widget): fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: str | float = ..., + height: float | str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: float | str = ..., image: _Image | str = ..., indicatoron: bool = ..., justify: Literal["left", "center", "right"] = ..., menu: Menu = ..., - padx: str | float = ..., - pady: str | float = ..., + padx: float | str = ..., + pady: float | str = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., state: Literal["normal", "active", "disabled"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = ..., textvariable: Variable = ..., underline: int = ..., - width: str | float = ..., - wraplength: str | float = ..., + width: float | str = ..., + wraplength: float | str = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -2828,27 +2828,27 @@ class Message(Widget): anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = "center", aspect: int = 150, background: str = ..., - bd: str | float = 1, + bd: float | str = 1, bg: str = ..., - border: str | float = 1, - borderwidth: str | float = 1, + border: float | str = 1, + borderwidth: float | str = 1, cursor: _Cursor = "", fg: str = ..., font: _FontDescription = "TkDefaultFont", foreground: str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = 0, + highlightthickness: float | str = 0, justify: Literal["left", "center", "right"] = "left", name: str = ..., - padx: str | float = ..., - pady: str | float = ..., + padx: float | str = ..., + pady: float | str = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = 0, text: float | str = "", textvariable: Variable = ..., # there's width but no height - width: str | float = 0, + width: float | str = 0, ) -> None: ... @overload def configure( @@ -2858,25 +2858,25 @@ class Message(Widget): anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., aspect: int = ..., background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., cursor: _Cursor = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: float | str = ..., justify: Literal["left", "center", "right"] = ..., - padx: str | float = ..., - pady: str | float = ..., + padx: float | str = ..., + pady: float | str = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = ..., textvariable: Variable = ..., - width: str | float = ..., + width: float | str = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -2892,11 +2892,11 @@ class Radiobutton(Widget): activeforeground: str = ..., anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = "center", background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., bitmap: str = "", - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., command: str | Callable[[], Any] = "", compound: Literal["top", "left", "center", "right", "bottom", "none"] = "none", cursor: _Cursor = "", @@ -2904,18 +2904,18 @@ class Radiobutton(Widget): fg: str = ..., font: _FontDescription = "TkDefaultFont", foreground: str = ..., - height: str | float = 0, + height: float | str = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = 1, + highlightthickness: float | str = 1, image: _Image | str = "", indicatoron: bool = True, justify: Literal["left", "center", "right"] = "center", name: str = ..., offrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., overrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove", ""] = "", - padx: str | float = 1, - pady: str | float = 1, + padx: float | str = 1, + pady: float | str = 1, relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", selectcolor: str = ..., selectimage: _Image | str = "", @@ -2928,8 +2928,8 @@ class Radiobutton(Widget): underline: int = -1, value: Any = "", variable: Variable | Literal[""] = ..., - width: str | float = 0, - wraplength: str | float = 0, + width: float | str = 0, + wraplength: float | str = 0, ) -> None: ... @overload def configure( @@ -2940,11 +2940,11 @@ class Radiobutton(Widget): activeforeground: str = ..., anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., bitmap: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., command: str | Callable[[], Any] = ..., compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., cursor: _Cursor = ..., @@ -2952,17 +2952,17 @@ class Radiobutton(Widget): fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: str | float = ..., + height: float | str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: float | str = ..., image: _Image | str = ..., indicatoron: bool = ..., justify: Literal["left", "center", "right"] = ..., offrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., overrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove", ""] = ..., - padx: str | float = ..., - pady: str | float = ..., + padx: float | str = ..., + pady: float | str = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., selectcolor: str = ..., selectimage: _Image | str = ..., @@ -2975,8 +2975,8 @@ class Radiobutton(Widget): underline: int = ..., value: Any = ..., variable: Variable | Literal[""] = ..., - width: str | float = ..., - wraplength: str | float = ..., + width: float | str = ..., + wraplength: float | str = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -2994,11 +2994,11 @@ class Scale(Widget): *, activebackground: str = ..., background: str = ..., - bd: str | float = 1, + bd: float | str = 1, bg: str = ..., bigincrement: float = 0.0, - border: str | float = 1, - borderwidth: str | float = 1, + border: float | str = 1, + borderwidth: float | str = 1, # don't know why the callback gets string instead of float command: str | Callable[[str], object] = "", cursor: _Cursor = "", @@ -3009,9 +3009,9 @@ class Scale(Widget): from_: float = 0.0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: float | str = ..., label: str = "", - length: str | float = 100, + length: float | str = 100, name: str = ..., orient: Literal["horizontal", "vertical"] = "vertical", relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", @@ -3019,7 +3019,7 @@ class Scale(Widget): repeatinterval: int = 100, resolution: float = 1.0, showvalue: bool = True, - sliderlength: str | float = 30, + sliderlength: float | str = 30, sliderrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "raised", state: Literal["normal", "active", "disabled"] = "normal", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", @@ -3027,7 +3027,7 @@ class Scale(Widget): to: float = 100.0, troughcolor: str = ..., variable: IntVar | DoubleVar = ..., - width: str | float = 15, + width: float | str = 15, ) -> None: ... @overload def configure( @@ -3036,11 +3036,11 @@ class Scale(Widget): *, activebackground: str = ..., background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., bigincrement: float = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., command: str | Callable[[str], object] = ..., cursor: _Cursor = ..., digits: int = ..., @@ -3050,16 +3050,16 @@ class Scale(Widget): from_: float = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: float | str = ..., label: str = ..., - length: str | float = ..., + length: float | str = ..., orient: Literal["horizontal", "vertical"] = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., repeatdelay: int = ..., repeatinterval: int = ..., resolution: float = ..., showvalue: bool = ..., - sliderlength: str | float = ..., + sliderlength: float | str = ..., sliderrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., state: Literal["normal", "active", "disabled"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., @@ -3067,7 +3067,7 @@ class Scale(Widget): to: float = ..., troughcolor: str = ..., variable: IntVar | DoubleVar = ..., - width: str | float = ..., + width: float | str = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -3086,20 +3086,20 @@ class Scrollbar(Widget): activebackground: str = ..., activerelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "raised", background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., # There are many ways how the command may get called. Search for # 'SCROLLING COMMANDS' in scrollbar man page. There doesn't seem to # be any way to specify an overloaded callback function, so we say # that it can take any args while it can't in reality. command: Callable[..., tuple[float, float] | None] | str = "", cursor: _Cursor = "", - elementborderwidth: str | float = -1, + elementborderwidth: float | str = -1, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = 0, + highlightthickness: float | str = 0, jump: bool = False, name: str = ..., orient: Literal["horizontal", "vertical"] = "vertical", @@ -3108,7 +3108,7 @@ class Scrollbar(Widget): repeatinterval: int = 100, takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", troughcolor: str = ..., - width: str | float = ..., + width: float | str = ..., ) -> None: ... @overload def configure( @@ -3118,16 +3118,16 @@ class Scrollbar(Widget): activebackground: str = ..., activerelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., command: Callable[..., tuple[float, float] | None] | str = ..., cursor: _Cursor = ..., - elementborderwidth: str | float = ..., + elementborderwidth: float | str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: float | str = ..., jump: bool = ..., orient: Literal["horizontal", "vertical"] = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., @@ -3135,7 +3135,7 @@ class Scrollbar(Widget): repeatinterval: int = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., troughcolor: str = ..., - width: str | float = ..., + width: float | str = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -3160,11 +3160,11 @@ class Text(Widget, XView, YView): *, autoseparators: bool = True, background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., blockcursor: bool = False, - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., cursor: _Cursor = "xterm", endline: int | Literal[""] = "", exportselection: bool = True, @@ -3174,33 +3174,33 @@ class Text(Widget, XView, YView): # width is always int, but height is allowed to be ScreenUnits. # This doesn't make any sense to me, and this isn't documented. # The docs seem to say that both should be integers. - height: str | float = 24, + height: float | str = 24, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: float | str = ..., inactiveselectbackground: str = ..., insertbackground: str = ..., - insertborderwidth: str | float = 0, + insertborderwidth: float | str = 0, insertofftime: int = 300, insertontime: int = 600, insertunfocussed: Literal["none", "hollow", "solid"] = "none", - insertwidth: str | float = ..., + insertwidth: float | str = ..., maxundo: int = 0, name: str = ..., - padx: str | float = 1, - pady: str | float = 1, + padx: float | str = 1, + pady: float | str = 1, relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., selectbackground: str = ..., - selectborderwidth: str | float = ..., + selectborderwidth: float | str = ..., selectforeground: str = ..., setgrid: bool = False, - spacing1: str | float = 0, - spacing2: str | float = 0, - spacing3: str | float = 0, + spacing1: float | str = 0, + spacing2: float | str = 0, + spacing3: float | str = 0, startline: int | Literal[""] = "", state: Literal["normal", "disabled"] = "normal", # Literal inside Tuple doesn't actually work - tabs: str | float | tuple[str | float, ...] = "", + tabs: float | str | tuple[float | str, ...] = "", tabstyle: Literal["tabular", "wordprocessor"] = "tabular", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", undo: bool = False, @@ -3216,42 +3216,42 @@ class Text(Widget, XView, YView): *, autoseparators: bool = ..., background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., blockcursor: bool = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., cursor: _Cursor = ..., endline: int | Literal[""] = ..., exportselection: bool = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: str | float = ..., + height: float | str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: float | str = ..., inactiveselectbackground: str = ..., insertbackground: str = ..., - insertborderwidth: str | float = ..., + insertborderwidth: float | str = ..., insertofftime: int = ..., insertontime: int = ..., insertunfocussed: Literal["none", "hollow", "solid"] = ..., - insertwidth: str | float = ..., + insertwidth: float | str = ..., maxundo: int = ..., - padx: str | float = ..., - pady: str | float = ..., + padx: float | str = ..., + pady: float | str = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., selectbackground: str = ..., - selectborderwidth: str | float = ..., + selectborderwidth: float | str = ..., selectforeground: str = ..., setgrid: bool = ..., - spacing1: str | float = ..., - spacing2: str | float = ..., - spacing3: str | float = ..., + spacing1: float | str = ..., + spacing2: float | str = ..., + spacing3: float | str = ..., startline: int | Literal[""] = ..., state: Literal["normal", "disabled"] = ..., - tabs: str | float | tuple[str | float, ...] = ..., + tabs: float | str | tuple[float | str, ...] = ..., tabstyle: Literal["tabular", "wordprocessor"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., undo: bool = ..., @@ -3469,8 +3469,8 @@ class Text(Widget, XView, YView): align: Literal["baseline", "bottom", "center", "top"] = ..., image: _Image | str = ..., name: str = ..., - padx: str | float = ..., - pady: str | float = ..., + padx: float | str = ..., + pady: float | str = ..., ) -> dict[str, tuple[str, str, str, str, str | int]] | None: ... def image_create( self, @@ -3480,8 +3480,8 @@ class Text(Widget, XView, YView): align: Literal["baseline", "bottom", "center", "top"] = ..., image: _Image | str = ..., name: str = ..., - padx: str | float = ..., - pady: str | float = ..., + padx: float | str = ..., + pady: float | str = ..., ) -> str: ... def image_names(self) -> tuple[str, ...]: ... def index(self, index: _TextIndex) -> str: ... @@ -3538,27 +3538,27 @@ class Text(Widget, XView, YView): *, background: str = ..., bgstipple: str = ..., - borderwidth: str | float = ..., - border: str | float = ..., # alias for borderwidth + borderwidth: float | str = ..., + border: float | str = ..., # alias for borderwidth elide: bool = ..., fgstipple: str = ..., font: _FontDescription = ..., foreground: str = ..., justify: Literal["left", "right", "center"] = ..., - lmargin1: str | float = ..., - lmargin2: str | float = ..., + lmargin1: float | str = ..., + lmargin2: float | str = ..., lmargincolor: str = ..., - offset: str | float = ..., + offset: float | str = ..., overstrike: bool = ..., overstrikefg: str = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., - rmargin: str | float = ..., + rmargin: float | str = ..., rmargincolor: str = ..., selectbackground: str = ..., selectforeground: str = ..., - spacing1: str | float = ..., - spacing2: str | float = ..., - spacing3: str | float = ..., + spacing1: float | str = ..., + spacing2: float | str = ..., + spacing3: float | str = ..., tabs: Any = ..., # the exact type is kind of complicated, see manual page tabstyle: Literal["tabular", "wordprocessor"] = ..., underline: bool = ..., @@ -3601,8 +3601,8 @@ class Text(Widget, XView, YView): *, align: Literal["baseline", "bottom", "center", "top"] = ..., create: str = ..., - padx: str | float = ..., - pady: str | float = ..., + padx: float | str = ..., + pady: float | str = ..., stretch: bool | Literal[0, 1] = ..., window: Misc | str = ..., ) -> dict[str, tuple[str, str, str, str, str | int]] | None: ... @@ -3614,8 +3614,8 @@ class Text(Widget, XView, YView): *, align: Literal["baseline", "bottom", "center", "top"] = ..., create: str = ..., - padx: str | float = ..., - pady: str | float = ..., + padx: float | str = ..., + pady: float | str = ..., stretch: bool | Literal[0, 1] = ..., window: Misc | str = ..., ) -> None: ... @@ -3809,10 +3809,10 @@ class Spinbox(Widget, XView): *, activebackground: str = ..., background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., buttonbackground: str = ..., buttoncursor: _Cursor = "", buttondownrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., @@ -3830,13 +3830,13 @@ class Spinbox(Widget, XView): from_: float = 0.0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: float | str = ..., increment: float = 1.0, insertbackground: str = ..., - insertborderwidth: str | float = 0, + insertborderwidth: float | str = 0, insertofftime: int = 300, insertontime: int = 600, - insertwidth: str | float = ..., + insertwidth: float | str = ..., invalidcommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = "", invcmd: str | list[str] | tuple[str, ...] | Callable[[], bool] = "", justify: Literal["left", "center", "right"] = "left", @@ -3846,7 +3846,7 @@ class Spinbox(Widget, XView): repeatdelay: int = 400, repeatinterval: int = 100, selectbackground: str = ..., - selectborderwidth: str | float = ..., + selectborderwidth: float | str = ..., selectforeground: str = ..., state: Literal["normal", "disabled", "readonly"] = "normal", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", @@ -3867,10 +3867,10 @@ class Spinbox(Widget, XView): *, activebackground: str = ..., background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., buttonbackground: str = ..., buttoncursor: _Cursor = ..., buttondownrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., @@ -3887,13 +3887,13 @@ class Spinbox(Widget, XView): from_: float = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: float | str = ..., increment: float = ..., insertbackground: str = ..., - insertborderwidth: str | float = ..., + insertborderwidth: float | str = ..., insertofftime: int = ..., insertontime: int = ..., - insertwidth: str | float = ..., + insertwidth: float | str = ..., invalidcommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., invcmd: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., justify: Literal["left", "center", "right"] = ..., @@ -3902,7 +3902,7 @@ class Spinbox(Widget, XView): repeatdelay: int = ..., repeatinterval: int = ..., selectbackground: str = ..., - selectborderwidth: str | float = ..., + selectborderwidth: float | str = ..., selectforeground: str = ..., state: Literal["normal", "disabled", "readonly"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., @@ -3947,10 +3947,10 @@ class LabelFrame(Widget): cnf: dict[str, Any] | None = {}, *, background: str = ..., - bd: str | float = 2, + bd: float | str = 2, bg: str = ..., - border: str | float = 2, - borderwidth: str | float = 2, + border: float | str = 2, + borderwidth: float | str = 2, class_: str = "Labelframe", # can't be changed with configure() colormap: Literal["new", ""] | Misc = "", # can't be changed with configure() container: bool = False, # undocumented, can't be changed with configure() @@ -3958,21 +3958,21 @@ class LabelFrame(Widget): fg: str = ..., font: _FontDescription = "TkDefaultFont", foreground: str = ..., - height: str | float = 0, + height: float | str = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = 0, + highlightthickness: float | str = 0, # 'ne' and 'en' are valid labelanchors, but only 'ne' is a valid _Anchor. labelanchor: Literal["nw", "n", "ne", "en", "e", "es", "se", "s", "sw", "ws", "w", "wn"] = "nw", labelwidget: Misc = ..., name: str = ..., - padx: str | float = 0, - pady: str | float = 0, + padx: float | str = 0, + pady: float | str = 0, relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "groove", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = 0, text: float | str = "", visual: str | tuple[str, int] = "", # can't be changed with configure() - width: str | float = 0, + width: float | str = 0, ) -> None: ... @overload def configure( @@ -3980,26 +3980,26 @@ class LabelFrame(Widget): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., cursor: _Cursor = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: str | float = ..., + height: float | str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: float | str = ..., labelanchor: Literal["nw", "n", "ne", "en", "e", "es", "se", "s", "sw", "ws", "w", "wn"] = ..., labelwidget: Misc = ..., - padx: str | float = ..., - pady: str | float = ..., + padx: float | str = ..., + pady: float | str = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = ..., - width: str | float = ..., + width: float | str = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -4012,27 +4012,27 @@ class PanedWindow(Widget): cnf: dict[str, Any] | None = {}, *, background: str = ..., - bd: str | float = 1, + bd: float | str = 1, bg: str = ..., - border: str | float = 1, - borderwidth: str | float = 1, + border: float | str = 1, + borderwidth: float | str = 1, cursor: _Cursor = "", - handlepad: str | float = 8, - handlesize: str | float = 8, - height: str | float = "", + handlepad: float | str = 8, + handlesize: float | str = 8, + height: float | str = "", name: str = ..., opaqueresize: bool = True, orient: Literal["horizontal", "vertical"] = "horizontal", proxybackground: str = "", - proxyborderwidth: str | float = 2, + proxyborderwidth: float | str = 2, proxyrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", sashcursor: _Cursor = "", - sashpad: str | float = 0, + sashpad: float | str = 0, sashrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", - sashwidth: str | float = 3, + sashwidth: float | str = 3, showhandle: bool = False, - width: str | float = "", + width: float | str = "", ) -> None: ... @overload def configure( @@ -4040,26 +4040,26 @@ class PanedWindow(Widget): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., cursor: _Cursor = ..., - handlepad: str | float = ..., - handlesize: str | float = ..., - height: str | float = ..., + handlepad: float | str = ..., + handlesize: float | str = ..., + height: float | str = ..., opaqueresize: bool = ..., orient: Literal["horizontal", "vertical"] = ..., proxybackground: str = ..., - proxyborderwidth: str | float = ..., + proxyborderwidth: float | str = ..., proxyrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., sashcursor: _Cursor = ..., - sashpad: str | float = ..., + sashpad: float | str = ..., sashrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., - sashwidth: str | float = ..., + sashwidth: float | str = ..., showhandle: bool = ..., - width: str | float = ..., + width: float | str = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... diff --git a/stdlib/tkinter/ttk.pyi b/stdlib/tkinter/ttk.pyi index ae69bd779c8f..1e9562808201 100644 --- a/stdlib/tkinter/ttk.pyi +++ b/stdlib/tkinter/ttk.pyi @@ -39,12 +39,12 @@ def tclobjs_to_py(adict: dict[Any, Any]) -> dict[Any, Any]: ... def setup_master(master: tkinter.Misc | None = None): ... _Padding: TypeAlias = ( - str - | float - | tuple[str | float] - | tuple[str | float, str | float] - | tuple[str | float, str | float, str | float] - | tuple[str | float, str | float, str | float, str | float] + float + | str + | tuple[float | str] + | tuple[float | str, float | str] + | tuple[float | str, float | str, float | str] + | tuple[float | str, float | str, float | str, float | str] ) # from ttk_widget (aka ttk::widget) manual page, differs from compound @@ -70,10 +70,10 @@ _LayoutSpec: TypeAlias = list[tuple[str, _Layout | None]] # Keep these in sync with the appropriate methods in Style class _ElementCreateImageKwargs(TypedDict, total=False): border: _Padding - height: str | float + height: float | str padding: _Padding sticky: str - width: str | float + width: float | str _ElementCreateArgsCrossPlatform: TypeAlias = ( # Could be any sequence here but types are not homogenous so just type it as tuple @@ -89,8 +89,8 @@ if sys.platform == "win32" and sys.version_info >= (3, 13): padding: _Padding class _ElementCreateVsapiKwargsSize(TypedDict): - width: str | float - height: str | float + width: float | str + height: float | str _ElementCreateVsapiKwargsDict: TypeAlias = ( _ElementCreateVsapiKwargsPadding | _ElementCreateVsapiKwargsMargin | _ElementCreateVsapiKwargsSize @@ -144,10 +144,10 @@ class Style: /, *imagespec: _ImageStatespec, border: _Padding = ..., - height: str | float = ..., + height: float | str = ..., padding: _Padding = ..., sticky: str = ..., - width: str | float = ..., + width: float | str = ..., ) -> None: ... @overload def element_create(self, elementname: str, etype: Literal["from"], themename: str, fromelement: str = ..., /) -> None: ... @@ -189,8 +189,8 @@ class Style: vs_statespec: _VsapiStatespec = ..., /, *, - width: str | float, - height: str | float, + width: float | str, + height: float | str, ) -> None: ... def element_names(self) -> tuple[str, ...]: ... @@ -476,32 +476,32 @@ class Frame(Widget): self, master: tkinter.Misc | None = None, *, - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., class_: str = "", cursor: tkinter._Cursor = "", - height: str | float = 0, + height: float | str = 0, name: str = ..., padding: _Padding = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., style: str = "", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", - width: str | float = 0, + width: float | str = 0, ) -> None: ... @overload def configure( self, cnf: dict[str, Any] | None = None, *, - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., cursor: tkinter._Cursor = ..., - height: str | float = ..., + height: float | str = ..., padding: _Padding = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., style: str = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., - width: str | float = ..., + width: float | str = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -514,8 +514,8 @@ class Label(Widget): *, anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., background: str = "", - border: str | float = ..., # alias for borderwidth - borderwidth: str | float = ..., # undocumented + border: float | str = ..., # alias for borderwidth + borderwidth: float | str = ..., # undocumented class_: str = "", compound: _TtkCompound = "", cursor: tkinter._Cursor = "", @@ -533,7 +533,7 @@ class Label(Widget): textvariable: tkinter.Variable = ..., underline: int = -1, width: int | Literal[""] = "", - wraplength: str | float = ..., + wraplength: float | str = ..., ) -> None: ... @overload def configure( @@ -542,8 +542,8 @@ class Label(Widget): *, anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., background: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., compound: _TtkCompound = ..., cursor: tkinter._Cursor = ..., font: _FontDescription = ..., @@ -559,7 +559,7 @@ class Label(Widget): textvariable: tkinter.Variable = ..., underline: int = ..., width: int | Literal[""] = ..., - wraplength: str | float = ..., + wraplength: float | str = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -570,11 +570,11 @@ class Labelframe(Widget): self, master: tkinter.Misc | None = None, *, - border: str | float = ..., - borderwidth: str | float = ..., # undocumented + border: float | str = ..., + borderwidth: float | str = ..., # undocumented class_: str = "", cursor: tkinter._Cursor = "", - height: str | float = 0, + height: float | str = 0, labelanchor: Literal["nw", "n", "ne", "en", "e", "es", "se", "s", "sw", "ws", "w", "wn"] = ..., labelwidget: tkinter.Misc = ..., name: str = ..., @@ -584,17 +584,17 @@ class Labelframe(Widget): takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", text: float | str = "", underline: int = -1, - width: str | float = 0, + width: float | str = 0, ) -> None: ... @overload def configure( self, cnf: dict[str, Any] | None = None, *, - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., cursor: tkinter._Cursor = ..., - height: str | float = ..., + height: float | str = ..., labelanchor: Literal["nw", "n", "ne", "en", "e", "es", "se", "s", "sw", "ws", "w", "wn"] = ..., labelwidget: tkinter.Misc = ..., padding: _Padding = ..., @@ -603,7 +603,7 @@ class Labelframe(Widget): takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = ..., underline: int = ..., - width: str | float = ..., + width: float | str = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -765,7 +765,7 @@ class Progressbar(Widget): *, class_: str = "", cursor: tkinter._Cursor = "", - length: str | float = 100, + length: float | str = 100, maximum: float = 100, mode: Literal["determinate", "indeterminate"] = "determinate", name: str = ..., @@ -782,7 +782,7 @@ class Progressbar(Widget): cnf: dict[str, Any] | None = None, *, cursor: tkinter._Cursor = ..., - length: str | float = ..., + length: float | str = ..., maximum: float = ..., mode: Literal["determinate", "indeterminate"] = ..., orient: Literal["horizontal", "vertical"] = ..., @@ -856,7 +856,7 @@ class Scale(Widget, tkinter.Scale): # type: ignore[misc] command: str | Callable[[str], object] = "", cursor: tkinter._Cursor = "", from_: float = 0, - length: str | float = 100, + length: float | str = 100, name: str = ..., orient: Literal["horizontal", "vertical"] = "horizontal", state: str = ..., # undocumented @@ -874,7 +874,7 @@ class Scale(Widget, tkinter.Scale): # type: ignore[misc] command: str | Callable[[str], object] = ..., cursor: tkinter._Cursor = ..., from_: float = ..., - length: str | float = ..., + length: float | str = ..., orient: Literal["horizontal", "vertical"] = ..., state: str = ..., style: str = ..., @@ -894,7 +894,7 @@ class Scale(Widget, tkinter.Scale): # type: ignore[misc] command: str | Callable[[str], object] = ..., cursor: tkinter._Cursor = ..., from_: float = ..., - length: str | float = ..., + length: float | str = ..., orient: Literal["horizontal", "vertical"] = ..., state: str = ..., style: str = ..., @@ -1314,18 +1314,18 @@ class LabeledScale(Frame): from_: float = 0, to: float = 10, *, - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., class_: str = "", compound: Literal["top", "bottom"] = "top", cursor: tkinter._Cursor = "", - height: str | float = 0, + height: float | str = 0, name: str = ..., padding: _Padding = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., style: str = "", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", - width: str | float = 0, + width: float | str = 0, ) -> None: ... # destroy is overridden, signature does not change value: Any diff --git a/stubs/ttkthemes/ttkthemes/themed_tk.pyi b/stubs/ttkthemes/ttkthemes/themed_tk.pyi index 64852728172c..3d749ebbee37 100644 --- a/stubs/ttkthemes/ttkthemes/themed_tk.pyi +++ b/stubs/ttkthemes/ttkthemes/themed_tk.pyi @@ -32,21 +32,21 @@ class ThemedTk(tkinter.Tk, ThemedWidget): toplevel: bool | None = ..., theme: str | None = ..., background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., cursor: tkinter._Cursor = ..., - height: str | float = ..., + height: float | str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: float | str = ..., menu: tkinter.Menu = ..., - padx: str | float = ..., - pady: str | float = ..., + padx: float | str = ..., + pady: float | str = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., - width: str | float = ..., + width: float | str = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... def cget(self, k: str) -> Any: ... def configure( # type: ignore[override] @@ -57,21 +57,21 @@ class ThemedTk(tkinter.Tk, ThemedWidget): toplevel: bool | None = ..., theme: str | None = ..., background: str = ..., - bd: str | float = ..., + bd: float | str = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: float | str = ..., + borderwidth: float | str = ..., cursor: tkinter._Cursor = ..., - height: str | float = ..., + height: float | str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: float | str = ..., menu: tkinter.Menu = ..., - padx: str | float = ..., - pady: str | float = ..., + padx: float | str = ..., + pady: float | str = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., - width: str | float = ..., + width: float | str = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... def __getitem__(self, k: str) -> Any: ... def __setitem__(self, k: str, v: Any) -> None: ... From 02f49db4c3722c83c33b25b236bdc0ddee98e789 Mon Sep 17 00:00:00 2001 From: donBarbos Date: Tue, 23 Sep 2025 22:30:03 +0400 Subject: [PATCH 3/4] Revert removing _ScreenUnits alias --- stdlib/tkinter/__init__.pyi | 881 ++++++++++++------------ stdlib/tkinter/ttk.pyi | 89 ++- stubs/ttkthemes/ttkthemes/themed_tk.pyi | 32 +- 3 files changed, 502 insertions(+), 500 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 456fe789f57b..08d867dc7bc0 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -175,6 +175,7 @@ EXCEPTION: Final = _tkinter.EXCEPTION # manual page: Tk_GetCursor _Cursor: TypeAlias = str | tuple[str] | tuple[str, str] | tuple[str, str, str] | tuple[str, str, str, str] +_ScreenUnits: TypeAlias = str | float # Often the right type instead of int. Manual page: Tk_GetPixels if sys.version_info >= (3, 11): @type_check_only @@ -366,8 +367,8 @@ _Ts = TypeVarTuple("_Ts") @type_check_only class _GridIndexInfo(TypedDict, total=False): - minsize: float | str - pad: float | str + minsize: _ScreenUnits + pad: _ScreenUnits uniform: str | None weight: int @@ -466,7 +467,7 @@ class Misc: def winfo_containing(self, rootX: int, rootY: int, displayof: Literal[0] | Misc | None = 0) -> Misc | None: ... def winfo_depth(self) -> int: ... def winfo_exists(self) -> bool: ... - def winfo_fpixels(self, number: float | str) -> float: ... + def winfo_fpixels(self, number: _ScreenUnits) -> float: ... def winfo_geometry(self) -> str: ... def winfo_height(self) -> int: ... def winfo_id(self) -> int: ... @@ -476,7 +477,7 @@ class Misc: def winfo_name(self) -> str: ... def winfo_parent(self) -> str: ... # return value needs nametowidget() def winfo_pathname(self, id: int, displayof: Literal[0] | Misc | None = 0): ... - def winfo_pixels(self, number: float | str) -> int: ... + def winfo_pixels(self, number: _ScreenUnits) -> int: ... def winfo_pointerx(self) -> int: ... def winfo_pointerxy(self) -> tuple[int, int]: ... def winfo_pointery(self) -> int: ... @@ -583,8 +584,8 @@ class Misc: index: int | str | list[int] | tuple[int, ...], cnf: _GridIndexInfo = {}, *, - minsize: float | str = ..., - pad: float | str = ..., + minsize: _ScreenUnits = ..., + pad: _ScreenUnits = ..., uniform: str = ..., weight: int = ..., ) -> _GridIndexInfo | MaybeNone: ... # can be None but annoying to check @@ -593,14 +594,14 @@ class Misc: index: int | str | list[int] | tuple[int, ...], cnf: _GridIndexInfo = {}, *, - minsize: float | str = ..., - pad: float | str = ..., + minsize: _ScreenUnits = ..., + pad: _ScreenUnits = ..., uniform: str = ..., weight: int = ..., ) -> _GridIndexInfo | MaybeNone: ... # can be None but annoying to check columnconfigure = grid_columnconfigure rowconfigure = grid_rowconfigure - def grid_location(self, x: float | str, y: float | str) -> tuple[int, int]: ... + def grid_location(self, x: _ScreenUnits, y: _ScreenUnits) -> tuple[int, int]: ... @overload def grid_propagate(self, flag: bool) -> None: ... @overload @@ -619,32 +620,32 @@ class Misc: sequence: str, *, above: Misc | int = ..., - borderwidth: float | str = ..., + borderwidth: _ScreenUnits = ..., button: int = ..., count: int = ..., data: Any = ..., # anything with usable str() value delta: int = ..., detail: str = ..., focus: bool = ..., - height: float | str = ..., + height: _ScreenUnits = ..., keycode: int = ..., keysym: str = ..., mode: str = ..., override: bool = ..., place: Literal["PlaceOnTop", "PlaceOnBottom"] = ..., root: Misc | int = ..., - rootx: float | str = ..., - rooty: float | str = ..., + rootx: _ScreenUnits = ..., + rooty: _ScreenUnits = ..., sendevent: bool = ..., serial: int = ..., state: int | str = ..., subwindow: Misc | int = ..., time: int = ..., warp: bool = ..., - width: float | str = ..., + width: _ScreenUnits = ..., when: Literal["now", "tail", "head", "mark"] = ..., - x: float | str = ..., - y: float | str = ..., + x: _ScreenUnits = ..., + y: _ScreenUnits = ..., ) -> None: ... def event_info(self, virtual: str | None = None) -> tuple[str, ...]: ... def image_names(self) -> tuple[str, ...]: ... @@ -673,7 +674,7 @@ class XView: @overload def xview_scroll(self, number: int, what: Literal["units", "pages"]) -> None: ... @overload - def xview_scroll(self, number: float | str, what: Literal["pixels"]) -> None: ... + def xview_scroll(self, number: _ScreenUnits, what: Literal["pixels"]) -> None: ... class YView: @overload @@ -684,7 +685,7 @@ class YView: @overload def yview_scroll(self, number: int, what: Literal["units", "pages"]) -> None: ... @overload - def yview_scroll(self, number: float | str, what: Literal["pixels"]) -> None: ... + def yview_scroll(self, number: _ScreenUnits, what: Literal["pixels"]) -> None: ... if sys.platform == "darwin": @type_check_only @@ -980,21 +981,21 @@ class Tk(Misc, Wm): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = ..., - height: float | str = ..., + height: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = ..., + highlightthickness: _ScreenUnits = ..., menu: Menu = ..., - padx: float | str = ..., - pady: float | str = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., - width: float | str = ..., + width: _ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -1047,7 +1048,7 @@ class _PackInfo(_InMiscTotal): expand: bool fill: Literal["none", "x", "y", "both"] side: Literal["left", "right", "top", "bottom"] - # Paddings come out as int or tuple of int, even though any screen units + # Paddings come out as int or tuple of int, even though any _ScreenUnits # can be specified in pack(). ipadx: int ipady: int @@ -1056,7 +1057,7 @@ class _PackInfo(_InMiscTotal): class Pack: # _PackInfo is not the valid type for cnf because pad stuff accepts any - # screen units instead of int only. I didn't bother to create another + # _ScreenUnits instead of int only. I didn't bother to create another # TypedDict for cnf because it appears to be a legacy thing that was # replaced by **kwargs. def pack_configure( @@ -1069,10 +1070,10 @@ class Pack: expand: bool | Literal[0, 1] = 0, fill: Literal["none", "x", "y", "both"] = ..., side: Literal["left", "right", "top", "bottom"] = ..., - ipadx: float | str = ..., - ipady: float | str = ..., - padx: float | str | tuple[float | str, float | str] = ..., - pady: float | str | tuple[float | str, float | str] = ..., + ipadx: _ScreenUnits = ..., + ipady: _ScreenUnits = ..., + padx: _ScreenUnits | tuple[_ScreenUnits, _ScreenUnits] = ..., + pady: _ScreenUnits | tuple[_ScreenUnits, _ScreenUnits] = ..., in_: Misc = ..., **kw: Any, # allow keyword argument named 'in', see #4836 ) -> None: ... @@ -1102,10 +1103,10 @@ class Place: *, anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., bordermode: Literal["inside", "outside", "ignore"] = ..., - width: float | str = ..., - height: float | str = ..., - x: float | str = ..., - y: float | str = ..., + width: _ScreenUnits = ..., + height: _ScreenUnits = ..., + x: _ScreenUnits = ..., + y: _ScreenUnits = ..., # str allowed for compatibility with place_info() relheight: str | float = ..., relwidth: str | float = ..., @@ -1140,10 +1141,10 @@ class Grid: columnspan: int = ..., row: int = ..., rowspan: int = ..., - ipadx: float | str = ..., - ipady: float | str = ..., - padx: float | str | tuple[float | str, float | str] = ..., - pady: float | str | tuple[float | str, float | str] = ..., + ipadx: _ScreenUnits = ..., + ipady: _ScreenUnits = ..., + padx: _ScreenUnits | tuple[_ScreenUnits, _ScreenUnits] = ..., + pady: _ScreenUnits | tuple[_ScreenUnits, _ScreenUnits] = ..., sticky: str = ..., # consists of letters 'n', 's', 'w', 'e', may contain repeats, may be empty in_: Misc = ..., **kw: Any, # allow keyword argument named 'in', see #4836 @@ -1188,28 +1189,28 @@ class Toplevel(BaseWidget, Wm): cnf: dict[str, Any] | None = {}, *, background: str = ..., - bd: float | str = 0, + bd: _ScreenUnits = 0, bg: str = ..., - border: float | str = 0, - borderwidth: float | str = 0, + border: _ScreenUnits = 0, + borderwidth: _ScreenUnits = 0, class_: str = "Toplevel", colormap: Literal["new", ""] | Misc = "", container: bool = False, cursor: _Cursor = "", - height: float | str = 0, + height: _ScreenUnits = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = 0, + highlightthickness: _ScreenUnits = 0, menu: Menu = ..., name: str = ..., - padx: float | str = 0, - pady: float | str = 0, + padx: _ScreenUnits = 0, + pady: _ScreenUnits = 0, relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", screen: str = "", # can't be changed after creating widget takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = 0, use: int = ..., visual: str | tuple[str, int] = "", - width: float | str = 0, + width: _ScreenUnits = 0, ) -> None: ... @overload def configure( @@ -1217,21 +1218,21 @@ class Toplevel(BaseWidget, Wm): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = ..., - height: float | str = ..., + height: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = ..., + highlightthickness: _ScreenUnits = ..., menu: Menu = ..., - padx: float | str = ..., - pady: float | str = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., - width: float | str = ..., + width: _ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -1247,11 +1248,11 @@ class Button(Widget): activeforeground: str = ..., anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = "center", background: str = ..., - bd: float | str = ..., # same as borderwidth + bd: _ScreenUnits = ..., # same as borderwidth bg: str = ..., # same as background bitmap: str = "", - border: float | str = ..., # same as borderwidth - borderwidth: float | str = ..., + border: _ScreenUnits = ..., # same as borderwidth + borderwidth: _ScreenUnits = ..., command: str | Callable[[], Any] = "", compound: Literal["top", "left", "center", "right", "bottom", "none"] = "none", cursor: _Cursor = "", @@ -1262,16 +1263,16 @@ class Button(Widget): foreground: str = ..., # width and height must be int for buttons containing just text, but # buttons with an image accept any screen units. - height: float | str = 0, + height: _ScreenUnits = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = 1, + highlightthickness: _ScreenUnits = 1, image: _Image | str = "", justify: Literal["left", "center", "right"] = "center", name: str = ..., overrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove", ""] = "", - padx: float | str = ..., - pady: float | str = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., repeatdelay: int = ..., repeatinterval: int = ..., @@ -1283,8 +1284,8 @@ class Button(Widget): # of an IntVar. textvariable: Variable = ..., underline: int = -1, - width: float | str = 0, - wraplength: float | str = 0, + width: _ScreenUnits = 0, + wraplength: _ScreenUnits = 0, ) -> None: ... @overload def configure( @@ -1295,11 +1296,11 @@ class Button(Widget): activeforeground: str = ..., anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., bitmap: str = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., command: str | Callable[[], Any] = ..., compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., cursor: _Cursor = ..., @@ -1308,15 +1309,15 @@ class Button(Widget): fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: float | str = ..., + height: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = ..., + highlightthickness: _ScreenUnits = ..., image: _Image | str = ..., justify: Literal["left", "center", "right"] = ..., overrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove", ""] = ..., - padx: float | str = ..., - pady: float | str = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., repeatdelay: int = ..., repeatinterval: int = ..., @@ -1325,8 +1326,8 @@ class Button(Widget): text: float | str = ..., textvariable: Variable = ..., underline: int = ..., - width: float | str = ..., - wraplength: float | str = ..., + width: _ScreenUnits = ..., + wraplength: _ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -1341,41 +1342,41 @@ class Canvas(Widget, XView, YView): cnf: dict[str, Any] | None = {}, *, background: str = ..., - bd: float | str = 0, + bd: _ScreenUnits = 0, bg: str = ..., - border: float | str = 0, - borderwidth: float | str = 0, + border: _ScreenUnits = 0, + borderwidth: _ScreenUnits = 0, closeenough: float = 1.0, confine: bool = True, cursor: _Cursor = "", # canvas manual page has a section named COORDINATES, and the first - # part of it describes str or float type. - height: float | str = ..., # see COORDINATES in canvas manual page + # part of it describes _ScreenUnits. + height: _ScreenUnits = ..., # see COORDINATES in canvas manual page highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = ..., + highlightthickness: _ScreenUnits = ..., insertbackground: str = ..., - insertborderwidth: float | str = 0, + insertborderwidth: _ScreenUnits = 0, insertofftime: int = 300, insertontime: int = 600, - insertwidth: float | str = 2, + insertwidth: _ScreenUnits = 2, name: str = ..., offset=..., # undocumented relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", # Setting scrollregion to None doesn't reset it back to empty, # but setting it to () does. - scrollregion: tuple[float | str, float | str, float | str, float | str] | tuple[()] = (), + scrollregion: tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits] | tuple[()] = (), selectbackground: str = ..., - selectborderwidth: float | str = 1, + selectborderwidth: _ScreenUnits = 1, selectforeground: str = ..., # man page says that state can be 'hidden', but it can't state: Literal["normal", "disabled"] = "normal", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", - width: float | str = ..., + width: _ScreenUnits = ..., xscrollcommand: str | Callable[[float, float], object] = "", - xscrollincrement: float | str = 0, + xscrollincrement: _ScreenUnits = 0, yscrollcommand: str | Callable[[float, float], object] = "", - yscrollincrement: float | str = 0, + yscrollincrement: _ScreenUnits = 0, ) -> None: ... @overload def configure( @@ -1383,35 +1384,35 @@ class Canvas(Widget, XView, YView): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., closeenough: float = ..., confine: bool = ..., cursor: _Cursor = ..., - height: float | str = ..., + height: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = ..., + highlightthickness: _ScreenUnits = ..., insertbackground: str = ..., - insertborderwidth: float | str = ..., + insertborderwidth: _ScreenUnits = ..., insertofftime: int = ..., insertontime: int = ..., - insertwidth: float | str = ..., + insertwidth: _ScreenUnits = ..., offset=..., # undocumented relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., - scrollregion: tuple[float | str, float | str, float | str, float | str] | tuple[()] = ..., + scrollregion: tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits] | tuple[()] = ..., selectbackground: str = ..., - selectborderwidth: float | str = ..., + selectborderwidth: _ScreenUnits = ..., selectforeground: str = ..., state: Literal["normal", "disabled"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., - width: float | str = ..., + width: _ScreenUnits = ..., xscrollcommand: str | Callable[[float, float], object] = ..., - xscrollincrement: float | str = ..., + xscrollincrement: _ScreenUnits = ..., yscrollcommand: str | Callable[[float, float], object] = ..., - yscrollincrement: float | str = ..., + yscrollincrement: _ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -1421,20 +1422,20 @@ class Canvas(Widget, XView, YView): def addtag_all(self, newtag: str) -> None: ... def addtag_below(self, newtag: str, tagOrId: str | int) -> None: ... def addtag_closest( - self, newtag: str, x: float | str, y: float | str, halo: float | str | None = None, start: str | int | None = None + self, newtag: str, x: _ScreenUnits, y: _ScreenUnits, halo: _ScreenUnits | None = None, start: str | int | None = None ) -> None: ... - def addtag_enclosed(self, newtag: str, x1: float | str, y1: float | str, x2: float | str, y2: float | str) -> None: ... - def addtag_overlapping(self, newtag: str, x1: float | str, y1: float | str, x2: float | str, y2: float | str) -> None: ... + def addtag_enclosed(self, newtag: str, x1: _ScreenUnits, y1: _ScreenUnits, x2: _ScreenUnits, y2: _ScreenUnits) -> None: ... + def addtag_overlapping(self, newtag: str, x1: _ScreenUnits, y1: _ScreenUnits, x2: _ScreenUnits, y2: _ScreenUnits) -> None: ... def addtag_withtag(self, newtag: str, tagOrId: str | int) -> None: ... def find(self, *args): ... # internal method def find_above(self, tagOrId: str | int) -> tuple[int, ...]: ... def find_all(self) -> tuple[int, ...]: ... def find_below(self, tagOrId: str | int) -> tuple[int, ...]: ... def find_closest( - self, x: float | str, y: float | str, halo: float | str | None = None, start: str | int | None = None + self, x: _ScreenUnits, y: _ScreenUnits, halo: _ScreenUnits | None = None, start: str | int | None = None ) -> tuple[int, ...]: ... - def find_enclosed(self, x1: float | str, y1: float | str, x2: float | str, y2: float | str) -> tuple[int, ...]: ... - def find_overlapping(self, x1: float | str, y1: float | str, x2: float | str, y2: float) -> tuple[int, ...]: ... + def find_enclosed(self, x1: _ScreenUnits, y1: _ScreenUnits, x2: _ScreenUnits, y2: _ScreenUnits) -> tuple[int, ...]: ... + def find_overlapping(self, x1: _ScreenUnits, y1: _ScreenUnits, x2: _ScreenUnits, y2: float) -> tuple[int, ...]: ... def find_withtag(self, tagOrId: str | int) -> tuple[int, ...]: ... # Incompatible with Misc.bbox(), tkinter violates LSP def bbox(self, *args: str | int) -> tuple[int, int, int, int]: ... # type: ignore[override] @@ -1479,25 +1480,25 @@ class Canvas(Widget, XView, YView): activedash: str | int | list[int] | tuple[int, ...] = ..., activefill: str = ..., activestipple: str = ..., - activewidth: float | str = ..., + activewidth: _ScreenUnits = ..., arrow: Literal["first", "last", "both"] = ..., arrowshape: tuple[float, float, float] = ..., capstyle: Literal["round", "projecting", "butt"] = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: float | str = ..., + dashoffset: _ScreenUnits = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledstipple: str = ..., - disabledwidth: float | str = ..., + disabledwidth: _ScreenUnits = ..., fill: str = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: float | str = ..., + offset: _ScreenUnits = ..., smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: float | str = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_line( @@ -1509,25 +1510,25 @@ class Canvas(Widget, XView, YView): activedash: str | int | list[int] | tuple[int, ...] = ..., activefill: str = ..., activestipple: str = ..., - activewidth: float | str = ..., + activewidth: _ScreenUnits = ..., arrow: Literal["first", "last", "both"] = ..., arrowshape: tuple[float, float, float] = ..., capstyle: Literal["round", "projecting", "butt"] = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: float | str = ..., + dashoffset: _ScreenUnits = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledstipple: str = ..., - disabledwidth: float | str = ..., + disabledwidth: _ScreenUnits = ..., fill: str = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: float | str = ..., + offset: _ScreenUnits = ..., smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: float | str = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_line( @@ -1545,25 +1546,25 @@ class Canvas(Widget, XView, YView): activedash: str | int | list[int] | tuple[int, ...] = ..., activefill: str = ..., activestipple: str = ..., - activewidth: float | str = ..., + activewidth: _ScreenUnits = ..., arrow: Literal["first", "last", "both"] = ..., arrowshape: tuple[float, float, float] = ..., capstyle: Literal["round", "projecting", "butt"] = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: float | str = ..., + dashoffset: _ScreenUnits = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledstipple: str = ..., - disabledwidth: float | str = ..., + disabledwidth: _ScreenUnits = ..., fill: str = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: float | str = ..., + offset: _ScreenUnits = ..., smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: float | str = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_oval( @@ -1579,24 +1580,24 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: float | str = ..., + activewidth: _ScreenUnits = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: float | str = ..., + dashoffset: _ScreenUnits = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: float | str = ..., + disabledwidth: _ScreenUnits = ..., fill: str = ..., - offset: float | str = ..., + offset: _ScreenUnits = ..., outline: str = ..., - outlineoffset: float | str = ..., + outlineoffset: _ScreenUnits = ..., outlinestipple: str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: float | str = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_oval( @@ -1610,24 +1611,24 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: float | str = ..., + activewidth: _ScreenUnits = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: float | str = ..., + dashoffset: _ScreenUnits = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: float | str = ..., + disabledwidth: _ScreenUnits = ..., fill: str = ..., - offset: float | str = ..., + offset: _ScreenUnits = ..., outline: str = ..., - outlineoffset: float | str = ..., + outlineoffset: _ScreenUnits = ..., outlinestipple: str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: float | str = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_oval( @@ -1647,24 +1648,24 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: float | str = ..., + activewidth: _ScreenUnits = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: float | str = ..., + dashoffset: _ScreenUnits = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: float | str = ..., + disabledwidth: _ScreenUnits = ..., fill: str = ..., - offset: float | str = ..., + offset: _ScreenUnits = ..., outline: str = ..., - outlineoffset: float | str = ..., + outlineoffset: _ScreenUnits = ..., outlinestipple: str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: float | str = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_polygon( @@ -1680,27 +1681,27 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: float | str = ..., + activewidth: _ScreenUnits = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: float | str = ..., + dashoffset: _ScreenUnits = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: float | str = ..., + disabledwidth: _ScreenUnits = ..., fill: str = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: float | str = ..., + offset: _ScreenUnits = ..., outline: str = ..., - outlineoffset: float | str = ..., + outlineoffset: _ScreenUnits = ..., outlinestipple: str = ..., smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: float | str = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_polygon( @@ -1714,27 +1715,27 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: float | str = ..., + activewidth: _ScreenUnits = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: float | str = ..., + dashoffset: _ScreenUnits = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: float | str = ..., + disabledwidth: _ScreenUnits = ..., fill: str = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: float | str = ..., + offset: _ScreenUnits = ..., outline: str = ..., - outlineoffset: float | str = ..., + outlineoffset: _ScreenUnits = ..., outlinestipple: str = ..., smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: float | str = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_polygon( @@ -1754,27 +1755,27 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: float | str = ..., + activewidth: _ScreenUnits = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: float | str = ..., + dashoffset: _ScreenUnits = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: float | str = ..., + disabledwidth: _ScreenUnits = ..., fill: str = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: float | str = ..., + offset: _ScreenUnits = ..., outline: str = ..., - outlineoffset: float | str = ..., + outlineoffset: _ScreenUnits = ..., outlinestipple: str = ..., smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: float | str = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_rectangle( @@ -1790,24 +1791,24 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: float | str = ..., + activewidth: _ScreenUnits = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: float | str = ..., + dashoffset: _ScreenUnits = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: float | str = ..., + disabledwidth: _ScreenUnits = ..., fill: str = ..., - offset: float | str = ..., + offset: _ScreenUnits = ..., outline: str = ..., - outlineoffset: float | str = ..., + outlineoffset: _ScreenUnits = ..., outlinestipple: str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: float | str = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_rectangle( @@ -1821,24 +1822,24 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: float | str = ..., + activewidth: _ScreenUnits = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: float | str = ..., + dashoffset: _ScreenUnits = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: float | str = ..., + disabledwidth: _ScreenUnits = ..., fill: str = ..., - offset: float | str = ..., + offset: _ScreenUnits = ..., outline: str = ..., - outlineoffset: float | str = ..., + outlineoffset: _ScreenUnits = ..., outlinestipple: str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: float | str = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_rectangle( @@ -1858,24 +1859,24 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: float | str = ..., + activewidth: _ScreenUnits = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: float | str = ..., + dashoffset: _ScreenUnits = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: float | str = ..., + disabledwidth: _ScreenUnits = ..., fill: str = ..., - offset: float | str = ..., + offset: _ScreenUnits = ..., outline: str = ..., - outlineoffset: float | str = ..., + outlineoffset: _ScreenUnits = ..., outlinestipple: str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: float | str = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_text( @@ -1893,12 +1894,12 @@ class Canvas(Widget, XView, YView): fill: str = ..., font: _FontDescription = ..., justify: Literal["left", "center", "right"] = ..., - offset: float | str = ..., + offset: _ScreenUnits = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., text: float | str = ..., - width: float | str = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_text( @@ -1915,12 +1916,12 @@ class Canvas(Widget, XView, YView): fill: str = ..., font: _FontDescription = ..., justify: Literal["left", "center", "right"] = ..., - offset: float | str = ..., + offset: _ScreenUnits = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., text: float | str = ..., - width: float | str = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_window( @@ -1930,10 +1931,10 @@ class Canvas(Widget, XView, YView): /, *, anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., - height: float | str = ..., + height: _ScreenUnits = ..., state: Literal["normal", "hidden", "disabled"] = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: float | str = ..., + width: _ScreenUnits = ..., window: Widget = ..., ) -> int: ... @overload @@ -1943,10 +1944,10 @@ class Canvas(Widget, XView, YView): /, *, anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., - height: float | str = ..., + height: _ScreenUnits = ..., state: Literal["normal", "hidden", "disabled"] = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: float | str = ..., + width: _ScreenUnits = ..., window: Widget = ..., ) -> int: ... def dchars(self, *args) -> None: ... @@ -1979,7 +1980,9 @@ class Canvas(Widget, XView, YView): def tag_raise(self, first: str | int, second: str | int | None = ..., /) -> None: ... def tkraise(self, first: str | int, second: str | int | None = ..., /) -> None: ... # type: ignore[override] def lift(self, first: str | int, second: str | int | None = ..., /) -> None: ... # type: ignore[override] - def scale(self, tagOrId: str | int, xOrigin: float | str, yOrigin: float | str, xScale: float, yScale: float, /) -> None: ... + def scale( + self, tagOrId: str | int, xOrigin: _ScreenUnits, yOrigin: _ScreenUnits, xScale: float, yScale: float, / + ) -> None: ... def scan_mark(self, x, y) -> None: ... def scan_dragto(self, x, y, gain: int = 10) -> None: ... def select_adjust(self, tagOrId, index) -> None: ... @@ -1999,11 +2002,11 @@ class Checkbutton(Widget): activeforeground: str = ..., anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = "center", background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., bitmap: str = "", - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., command: str | Callable[[], Any] = "", compound: Literal["top", "left", "center", "right", "bottom", "none"] = "none", cursor: _Cursor = "", @@ -2011,10 +2014,10 @@ class Checkbutton(Widget): fg: str = ..., font: _FontDescription = "TkDefaultFont", foreground: str = ..., - height: float | str = 0, + height: _ScreenUnits = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = 1, + highlightthickness: _ScreenUnits = 1, image: _Image | str = "", indicatoron: bool = True, justify: Literal["left", "center", "right"] = "center", @@ -2033,8 +2036,8 @@ class Checkbutton(Widget): offvalue: Any = 0, onvalue: Any = 1, overrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove", ""] = "", - padx: float | str = 1, - pady: float | str = 1, + padx: _ScreenUnits = 1, + pady: _ScreenUnits = 1, relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", selectcolor: str = ..., selectimage: _Image | str = "", @@ -2046,8 +2049,8 @@ class Checkbutton(Widget): tristatevalue: Any = "", underline: int = -1, variable: Variable | Literal[""] = ..., - width: float | str = 0, - wraplength: float | str = 0, + width: _ScreenUnits = 0, + wraplength: _ScreenUnits = 0, ) -> None: ... @overload def configure( @@ -2058,11 +2061,11 @@ class Checkbutton(Widget): activeforeground: str = ..., anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., bitmap: str = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., command: str | Callable[[], Any] = ..., compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., cursor: _Cursor = ..., @@ -2070,10 +2073,10 @@ class Checkbutton(Widget): fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: float | str = ..., + height: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = ..., + highlightthickness: _ScreenUnits = ..., image: _Image | str = ..., indicatoron: bool = ..., justify: Literal["left", "center", "right"] = ..., @@ -2081,8 +2084,8 @@ class Checkbutton(Widget): offvalue: Any = ..., onvalue: Any = ..., overrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove", ""] = ..., - padx: float | str = ..., - pady: float | str = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., selectcolor: str = ..., selectimage: _Image | str = ..., @@ -2094,8 +2097,8 @@ class Checkbutton(Widget): tristatevalue: Any = ..., underline: int = ..., variable: Variable | Literal[""] = ..., - width: float | str = ..., - wraplength: float | str = ..., + width: _ScreenUnits = ..., + wraplength: _ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -2113,10 +2116,10 @@ class Entry(Widget, XView): cnf: dict[str, Any] | None = {}, *, background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = "xterm", disabledbackground: str = ..., disabledforeground: str = ..., @@ -2126,12 +2129,12 @@ class Entry(Widget, XView): foreground: str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = ..., + highlightthickness: _ScreenUnits = ..., insertbackground: str = ..., - insertborderwidth: float | str = 0, + insertborderwidth: _ScreenUnits = 0, insertofftime: int = 300, insertontime: int = 600, - insertwidth: float | str = ..., + insertwidth: _ScreenUnits = ..., invalidcommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = "", invcmd: str | list[str] | tuple[str, ...] | Callable[[], bool] = "", # same as invalidcommand justify: Literal["left", "center", "right"] = "left", @@ -2139,7 +2142,7 @@ class Entry(Widget, XView): readonlybackground: str = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "sunken", selectbackground: str = ..., - selectborderwidth: float | str = ..., + selectborderwidth: _ScreenUnits = ..., selectforeground: str = ..., show: str = "", state: Literal["normal", "disabled", "readonly"] = "normal", @@ -2157,10 +2160,10 @@ class Entry(Widget, XView): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = ..., disabledbackground: str = ..., disabledforeground: str = ..., @@ -2170,19 +2173,19 @@ class Entry(Widget, XView): foreground: str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = ..., + highlightthickness: _ScreenUnits = ..., insertbackground: str = ..., - insertborderwidth: float | str = ..., + insertborderwidth: _ScreenUnits = ..., insertofftime: int = ..., insertontime: int = ..., - insertwidth: float | str = ..., + insertwidth: _ScreenUnits = ..., invalidcommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., invcmd: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., justify: Literal["left", "center", "right"] = ..., readonlybackground: str = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., selectbackground: str = ..., - selectborderwidth: float | str = ..., + selectborderwidth: _ScreenUnits = ..., selectforeground: str = ..., show: str = ..., state: Literal["normal", "disabled", "readonly"] = ..., @@ -2224,25 +2227,25 @@ class Frame(Widget): cnf: dict[str, Any] | None = {}, *, background: str = ..., - bd: float | str = 0, + bd: _ScreenUnits = 0, bg: str = ..., - border: float | str = 0, - borderwidth: float | str = 0, + border: _ScreenUnits = 0, + borderwidth: _ScreenUnits = 0, class_: str = "Frame", # can't be changed with configure() colormap: Literal["new", ""] | Misc = "", # can't be changed with configure() container: bool = False, # can't be changed with configure() cursor: _Cursor = "", - height: float | str = 0, + height: _ScreenUnits = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = 0, + highlightthickness: _ScreenUnits = 0, name: str = ..., - padx: float | str = 0, - pady: float | str = 0, + padx: _ScreenUnits = 0, + pady: _ScreenUnits = 0, relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = 0, visual: str | tuple[str, int] = "", # can't be changed with configure() - width: float | str = 0, + width: _ScreenUnits = 0, ) -> None: ... @overload def configure( @@ -2250,20 +2253,20 @@ class Frame(Widget): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = ..., - height: float | str = ..., + height: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = ..., - padx: float | str = ..., - pady: float | str = ..., + highlightthickness: _ScreenUnits = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., - width: float | str = ..., + width: _ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -2279,34 +2282,34 @@ class Label(Widget): activeforeground: str = ..., anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = "center", background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., bitmap: str = "", - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., compound: Literal["top", "left", "center", "right", "bottom", "none"] = "none", cursor: _Cursor = "", disabledforeground: str = ..., fg: str = ..., font: _FontDescription = "TkDefaultFont", foreground: str = ..., - height: float | str = 0, + height: _ScreenUnits = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = 0, + highlightthickness: _ScreenUnits = 0, image: _Image | str = "", justify: Literal["left", "center", "right"] = "center", name: str = ..., - padx: float | str = 1, - pady: float | str = 1, + padx: _ScreenUnits = 1, + pady: _ScreenUnits = 1, relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", state: Literal["normal", "active", "disabled"] = "normal", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = 0, text: float | str = "", textvariable: Variable = ..., underline: int = -1, - width: float | str = 0, - wraplength: float | str = 0, + width: _ScreenUnits = 0, + wraplength: _ScreenUnits = 0, ) -> None: ... @overload def configure( @@ -2317,33 +2320,33 @@ class Label(Widget): activeforeground: str = ..., anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., bitmap: str = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., cursor: _Cursor = ..., disabledforeground: str = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: float | str = ..., + height: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = ..., + highlightthickness: _ScreenUnits = ..., image: _Image | str = ..., justify: Literal["left", "center", "right"] = ..., - padx: float | str = ..., - pady: float | str = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., state: Literal["normal", "active", "disabled"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = ..., textvariable: Variable = ..., underline: int = ..., - width: float | str = ..., - wraplength: float | str = ..., + width: _ScreenUnits = ..., + wraplength: _ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -2357,10 +2360,10 @@ class Listbox(Widget, XView, YView): *, activestyle: Literal["dotbox", "none", "underline"] = ..., background: str = ..., - bd: float | str = 1, + bd: _ScreenUnits = 1, bg: str = ..., - border: float | str = 1, - borderwidth: float | str = 1, + border: _ScreenUnits = 1, + borderwidth: _ScreenUnits = 1, cursor: _Cursor = "", disabledforeground: str = ..., exportselection: bool | Literal[0, 1] = 1, @@ -2370,7 +2373,7 @@ class Listbox(Widget, XView, YView): height: int = 10, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = ..., + highlightthickness: _ScreenUnits = ..., justify: Literal["left", "center", "right"] = "left", # There's no tkinter.ListVar, but seems like bare tkinter.Variable # actually works for this: @@ -2385,7 +2388,7 @@ class Listbox(Widget, XView, YView): name: str = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., selectbackground: str = ..., - selectborderwidth: float | str = 0, + selectborderwidth: _ScreenUnits = 0, selectforeground: str = ..., # from listbox man page: "The value of the [selectmode] option may be # arbitrary, but the default bindings expect it to be either single, @@ -2408,10 +2411,10 @@ class Listbox(Widget, XView, YView): *, activestyle: Literal["dotbox", "none", "underline"] = ..., background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = ..., disabledforeground: str = ..., exportselection: bool = ..., @@ -2421,12 +2424,12 @@ class Listbox(Widget, XView, YView): height: int = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = ..., + highlightthickness: _ScreenUnits = ..., justify: Literal["left", "center", "right"] = ..., listvariable: Variable = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., selectbackground: str = ..., - selectborderwidth: float | str = ..., + selectborderwidth: _ScreenUnits = ..., selectforeground: str = ..., selectmode: str | Literal["single", "browse", "multiple", "extended"] = ..., # noqa: Y051 setgrid: bool = ..., @@ -2470,13 +2473,13 @@ class Menu(Widget): cnf: dict[str, Any] | None = {}, *, activebackground: str = ..., - activeborderwidth: float | str = ..., + activeborderwidth: _ScreenUnits = ..., activeforeground: str = ..., background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = "arrow", disabledforeground: str = ..., fg: str = ..., @@ -2501,13 +2504,13 @@ class Menu(Widget): cnf: dict[str, Any] | None = None, *, activebackground: str = ..., - activeborderwidth: float | str = ..., + activeborderwidth: _ScreenUnits = ..., activeforeground: str = ..., background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = ..., disabledforeground: str = ..., fg: str = ..., @@ -2743,11 +2746,11 @@ class Menubutton(Widget): activeforeground: str = ..., anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., bitmap: str = "", - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., compound: Literal["top", "left", "center", "right", "bottom", "none"] = "none", cursor: _Cursor = "", direction: Literal["above", "below", "left", "right", "flush"] = "below", @@ -2755,25 +2758,25 @@ class Menubutton(Widget): fg: str = ..., font: _FontDescription = "TkDefaultFont", foreground: str = ..., - height: float | str = 0, + height: _ScreenUnits = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = 0, + highlightthickness: _ScreenUnits = 0, image: _Image | str = "", indicatoron: bool = ..., justify: Literal["left", "center", "right"] = ..., menu: Menu = ..., name: str = ..., - padx: float | str = ..., - pady: float | str = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", state: Literal["normal", "active", "disabled"] = "normal", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = 0, text: float | str = "", textvariable: Variable = ..., underline: int = -1, - width: float | str = 0, - wraplength: float | str = 0, + width: _ScreenUnits = 0, + wraplength: _ScreenUnits = 0, ) -> None: ... @overload def configure( @@ -2784,11 +2787,11 @@ class Menubutton(Widget): activeforeground: str = ..., anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., bitmap: str = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., cursor: _Cursor = ..., direction: Literal["above", "below", "left", "right", "flush"] = ..., @@ -2796,24 +2799,24 @@ class Menubutton(Widget): fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: float | str = ..., + height: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = ..., + highlightthickness: _ScreenUnits = ..., image: _Image | str = ..., indicatoron: bool = ..., justify: Literal["left", "center", "right"] = ..., menu: Menu = ..., - padx: float | str = ..., - pady: float | str = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., state: Literal["normal", "active", "disabled"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = ..., textvariable: Variable = ..., underline: int = ..., - width: float | str = ..., - wraplength: float | str = ..., + width: _ScreenUnits = ..., + wraplength: _ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -2828,27 +2831,27 @@ class Message(Widget): anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = "center", aspect: int = 150, background: str = ..., - bd: float | str = 1, + bd: _ScreenUnits = 1, bg: str = ..., - border: float | str = 1, - borderwidth: float | str = 1, + border: _ScreenUnits = 1, + borderwidth: _ScreenUnits = 1, cursor: _Cursor = "", fg: str = ..., font: _FontDescription = "TkDefaultFont", foreground: str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = 0, + highlightthickness: _ScreenUnits = 0, justify: Literal["left", "center", "right"] = "left", name: str = ..., - padx: float | str = ..., - pady: float | str = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = 0, text: float | str = "", textvariable: Variable = ..., # there's width but no height - width: float | str = 0, + width: _ScreenUnits = 0, ) -> None: ... @overload def configure( @@ -2858,25 +2861,25 @@ class Message(Widget): anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., aspect: int = ..., background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = ..., + highlightthickness: _ScreenUnits = ..., justify: Literal["left", "center", "right"] = ..., - padx: float | str = ..., - pady: float | str = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., - text: float | str = ..., + text: _ScreenUnits = ..., textvariable: Variable = ..., - width: float | str = ..., + width: _ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -2892,11 +2895,11 @@ class Radiobutton(Widget): activeforeground: str = ..., anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = "center", background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., bitmap: str = "", - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., command: str | Callable[[], Any] = "", compound: Literal["top", "left", "center", "right", "bottom", "none"] = "none", cursor: _Cursor = "", @@ -2904,18 +2907,18 @@ class Radiobutton(Widget): fg: str = ..., font: _FontDescription = "TkDefaultFont", foreground: str = ..., - height: float | str = 0, + height: _ScreenUnits = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = 1, + highlightthickness: _ScreenUnits = 1, image: _Image | str = "", indicatoron: bool = True, justify: Literal["left", "center", "right"] = "center", name: str = ..., offrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., overrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove", ""] = "", - padx: float | str = 1, - pady: float | str = 1, + padx: _ScreenUnits = 1, + pady: _ScreenUnits = 1, relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", selectcolor: str = ..., selectimage: _Image | str = "", @@ -2928,8 +2931,8 @@ class Radiobutton(Widget): underline: int = -1, value: Any = "", variable: Variable | Literal[""] = ..., - width: float | str = 0, - wraplength: float | str = 0, + width: _ScreenUnits = 0, + wraplength: _ScreenUnits = 0, ) -> None: ... @overload def configure( @@ -2940,11 +2943,11 @@ class Radiobutton(Widget): activeforeground: str = ..., anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., bitmap: str = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., command: str | Callable[[], Any] = ..., compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., cursor: _Cursor = ..., @@ -2952,17 +2955,17 @@ class Radiobutton(Widget): fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: float | str = ..., + height: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = ..., + highlightthickness: _ScreenUnits = ..., image: _Image | str = ..., indicatoron: bool = ..., justify: Literal["left", "center", "right"] = ..., offrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., overrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove", ""] = ..., - padx: float | str = ..., - pady: float | str = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., selectcolor: str = ..., selectimage: _Image | str = ..., @@ -2975,8 +2978,8 @@ class Radiobutton(Widget): underline: int = ..., value: Any = ..., variable: Variable | Literal[""] = ..., - width: float | str = ..., - wraplength: float | str = ..., + width: _ScreenUnits = ..., + wraplength: _ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -2994,11 +2997,11 @@ class Scale(Widget): *, activebackground: str = ..., background: str = ..., - bd: float | str = 1, + bd: _ScreenUnits = 1, bg: str = ..., bigincrement: float = 0.0, - border: float | str = 1, - borderwidth: float | str = 1, + border: _ScreenUnits = 1, + borderwidth: _ScreenUnits = 1, # don't know why the callback gets string instead of float command: str | Callable[[str], object] = "", cursor: _Cursor = "", @@ -3009,9 +3012,9 @@ class Scale(Widget): from_: float = 0.0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = ..., + highlightthickness: _ScreenUnits = ..., label: str = "", - length: float | str = 100, + length: _ScreenUnits = 100, name: str = ..., orient: Literal["horizontal", "vertical"] = "vertical", relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", @@ -3019,7 +3022,7 @@ class Scale(Widget): repeatinterval: int = 100, resolution: float = 1.0, showvalue: bool = True, - sliderlength: float | str = 30, + sliderlength: _ScreenUnits = 30, sliderrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "raised", state: Literal["normal", "active", "disabled"] = "normal", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", @@ -3027,7 +3030,7 @@ class Scale(Widget): to: float = 100.0, troughcolor: str = ..., variable: IntVar | DoubleVar = ..., - width: float | str = 15, + width: _ScreenUnits = 15, ) -> None: ... @overload def configure( @@ -3036,11 +3039,11 @@ class Scale(Widget): *, activebackground: str = ..., background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., bigincrement: float = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., command: str | Callable[[str], object] = ..., cursor: _Cursor = ..., digits: int = ..., @@ -3050,16 +3053,16 @@ class Scale(Widget): from_: float = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = ..., + highlightthickness: _ScreenUnits = ..., label: str = ..., - length: float | str = ..., + length: _ScreenUnits = ..., orient: Literal["horizontal", "vertical"] = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., repeatdelay: int = ..., repeatinterval: int = ..., resolution: float = ..., showvalue: bool = ..., - sliderlength: float | str = ..., + sliderlength: _ScreenUnits = ..., sliderrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., state: Literal["normal", "active", "disabled"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., @@ -3067,7 +3070,7 @@ class Scale(Widget): to: float = ..., troughcolor: str = ..., variable: IntVar | DoubleVar = ..., - width: float | str = ..., + width: _ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -3086,20 +3089,20 @@ class Scrollbar(Widget): activebackground: str = ..., activerelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "raised", background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., # There are many ways how the command may get called. Search for # 'SCROLLING COMMANDS' in scrollbar man page. There doesn't seem to # be any way to specify an overloaded callback function, so we say # that it can take any args while it can't in reality. command: Callable[..., tuple[float, float] | None] | str = "", cursor: _Cursor = "", - elementborderwidth: float | str = -1, + elementborderwidth: _ScreenUnits = -1, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = 0, + highlightthickness: _ScreenUnits = 0, jump: bool = False, name: str = ..., orient: Literal["horizontal", "vertical"] = "vertical", @@ -3108,7 +3111,7 @@ class Scrollbar(Widget): repeatinterval: int = 100, takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", troughcolor: str = ..., - width: float | str = ..., + width: _ScreenUnits = ..., ) -> None: ... @overload def configure( @@ -3118,16 +3121,16 @@ class Scrollbar(Widget): activebackground: str = ..., activerelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., command: Callable[..., tuple[float, float] | None] | str = ..., cursor: _Cursor = ..., - elementborderwidth: float | str = ..., + elementborderwidth: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = ..., + highlightthickness: _ScreenUnits = ..., jump: bool = ..., orient: Literal["horizontal", "vertical"] = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., @@ -3135,7 +3138,7 @@ class Scrollbar(Widget): repeatinterval: int = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., troughcolor: str = ..., - width: float | str = ..., + width: _ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -3160,11 +3163,11 @@ class Text(Widget, XView, YView): *, autoseparators: bool = True, background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., blockcursor: bool = False, - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = "xterm", endline: int | Literal[""] = "", exportselection: bool = True, @@ -3174,33 +3177,33 @@ class Text(Widget, XView, YView): # width is always int, but height is allowed to be ScreenUnits. # This doesn't make any sense to me, and this isn't documented. # The docs seem to say that both should be integers. - height: float | str = 24, + height: _ScreenUnits = 24, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = ..., + highlightthickness: _ScreenUnits = ..., inactiveselectbackground: str = ..., insertbackground: str = ..., - insertborderwidth: float | str = 0, + insertborderwidth: _ScreenUnits = 0, insertofftime: int = 300, insertontime: int = 600, insertunfocussed: Literal["none", "hollow", "solid"] = "none", - insertwidth: float | str = ..., + insertwidth: _ScreenUnits = ..., maxundo: int = 0, name: str = ..., - padx: float | str = 1, - pady: float | str = 1, + padx: _ScreenUnits = 1, + pady: _ScreenUnits = 1, relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., selectbackground: str = ..., - selectborderwidth: float | str = ..., + selectborderwidth: _ScreenUnits = ..., selectforeground: str = ..., setgrid: bool = False, - spacing1: float | str = 0, - spacing2: float | str = 0, - spacing3: float | str = 0, + spacing1: _ScreenUnits = 0, + spacing2: _ScreenUnits = 0, + spacing3: _ScreenUnits = 0, startline: int | Literal[""] = "", state: Literal["normal", "disabled"] = "normal", # Literal inside Tuple doesn't actually work - tabs: float | str | tuple[float | str, ...] = "", + tabs: _ScreenUnits | str | tuple[_ScreenUnits | str, ...] = "", tabstyle: Literal["tabular", "wordprocessor"] = "tabular", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", undo: bool = False, @@ -3216,42 +3219,42 @@ class Text(Widget, XView, YView): *, autoseparators: bool = ..., background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., blockcursor: bool = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = ..., endline: int | Literal[""] = ..., exportselection: bool = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: float | str = ..., + height: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = ..., + highlightthickness: _ScreenUnits = ..., inactiveselectbackground: str = ..., insertbackground: str = ..., - insertborderwidth: float | str = ..., + insertborderwidth: _ScreenUnits = ..., insertofftime: int = ..., insertontime: int = ..., insertunfocussed: Literal["none", "hollow", "solid"] = ..., - insertwidth: float | str = ..., + insertwidth: _ScreenUnits = ..., maxundo: int = ..., - padx: float | str = ..., - pady: float | str = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., selectbackground: str = ..., - selectborderwidth: float | str = ..., + selectborderwidth: _ScreenUnits = ..., selectforeground: str = ..., setgrid: bool = ..., - spacing1: float | str = ..., - spacing2: float | str = ..., - spacing3: float | str = ..., + spacing1: _ScreenUnits = ..., + spacing2: _ScreenUnits = ..., + spacing3: _ScreenUnits = ..., startline: int | Literal[""] = ..., state: Literal["normal", "disabled"] = ..., - tabs: float | str | tuple[float | str, ...] = ..., + tabs: _ScreenUnits | str | tuple[_ScreenUnits | str, ...] = ..., tabstyle: Literal["tabular", "wordprocessor"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., undo: bool = ..., @@ -3469,8 +3472,8 @@ class Text(Widget, XView, YView): align: Literal["baseline", "bottom", "center", "top"] = ..., image: _Image | str = ..., name: str = ..., - padx: float | str = ..., - pady: float | str = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, str, str | int]] | None: ... def image_create( self, @@ -3480,8 +3483,8 @@ class Text(Widget, XView, YView): align: Literal["baseline", "bottom", "center", "top"] = ..., image: _Image | str = ..., name: str = ..., - padx: float | str = ..., - pady: float | str = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., ) -> str: ... def image_names(self) -> tuple[str, ...]: ... def index(self, index: _TextIndex) -> str: ... @@ -3538,27 +3541,27 @@ class Text(Widget, XView, YView): *, background: str = ..., bgstipple: str = ..., - borderwidth: float | str = ..., - border: float | str = ..., # alias for borderwidth + borderwidth: _ScreenUnits = ..., + border: _ScreenUnits = ..., # alias for borderwidth elide: bool = ..., fgstipple: str = ..., font: _FontDescription = ..., foreground: str = ..., justify: Literal["left", "right", "center"] = ..., - lmargin1: float | str = ..., - lmargin2: float | str = ..., + lmargin1: _ScreenUnits = ..., + lmargin2: _ScreenUnits = ..., lmargincolor: str = ..., - offset: float | str = ..., + offset: _ScreenUnits = ..., overstrike: bool = ..., overstrikefg: str = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., - rmargin: float | str = ..., + rmargin: _ScreenUnits = ..., rmargincolor: str = ..., selectbackground: str = ..., selectforeground: str = ..., - spacing1: float | str = ..., - spacing2: float | str = ..., - spacing3: float | str = ..., + spacing1: _ScreenUnits = ..., + spacing2: _ScreenUnits = ..., + spacing3: _ScreenUnits = ..., tabs: Any = ..., # the exact type is kind of complicated, see manual page tabstyle: Literal["tabular", "wordprocessor"] = ..., underline: bool = ..., @@ -3601,8 +3604,8 @@ class Text(Widget, XView, YView): *, align: Literal["baseline", "bottom", "center", "top"] = ..., create: str = ..., - padx: float | str = ..., - pady: float | str = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., stretch: bool | Literal[0, 1] = ..., window: Misc | str = ..., ) -> dict[str, tuple[str, str, str, str, str | int]] | None: ... @@ -3614,8 +3617,8 @@ class Text(Widget, XView, YView): *, align: Literal["baseline", "bottom", "center", "top"] = ..., create: str = ..., - padx: float | str = ..., - pady: float | str = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., stretch: bool | Literal[0, 1] = ..., window: Misc | str = ..., ) -> None: ... @@ -3809,10 +3812,10 @@ class Spinbox(Widget, XView): *, activebackground: str = ..., background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., buttonbackground: str = ..., buttoncursor: _Cursor = "", buttondownrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., @@ -3830,13 +3833,13 @@ class Spinbox(Widget, XView): from_: float = 0.0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = ..., + highlightthickness: _ScreenUnits = ..., increment: float = 1.0, insertbackground: str = ..., - insertborderwidth: float | str = 0, + insertborderwidth: _ScreenUnits = 0, insertofftime: int = 300, insertontime: int = 600, - insertwidth: float | str = ..., + insertwidth: _ScreenUnits = ..., invalidcommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = "", invcmd: str | list[str] | tuple[str, ...] | Callable[[], bool] = "", justify: Literal["left", "center", "right"] = "left", @@ -3846,7 +3849,7 @@ class Spinbox(Widget, XView): repeatdelay: int = 400, repeatinterval: int = 100, selectbackground: str = ..., - selectborderwidth: float | str = ..., + selectborderwidth: _ScreenUnits = ..., selectforeground: str = ..., state: Literal["normal", "disabled", "readonly"] = "normal", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", @@ -3867,10 +3870,10 @@ class Spinbox(Widget, XView): *, activebackground: str = ..., background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., buttonbackground: str = ..., buttoncursor: _Cursor = ..., buttondownrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., @@ -3887,13 +3890,13 @@ class Spinbox(Widget, XView): from_: float = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = ..., + highlightthickness: _ScreenUnits = ..., increment: float = ..., insertbackground: str = ..., - insertborderwidth: float | str = ..., + insertborderwidth: _ScreenUnits = ..., insertofftime: int = ..., insertontime: int = ..., - insertwidth: float | str = ..., + insertwidth: _ScreenUnits = ..., invalidcommand: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., invcmd: str | list[str] | tuple[str, ...] | Callable[[], bool] = ..., justify: Literal["left", "center", "right"] = ..., @@ -3902,7 +3905,7 @@ class Spinbox(Widget, XView): repeatdelay: int = ..., repeatinterval: int = ..., selectbackground: str = ..., - selectborderwidth: float | str = ..., + selectborderwidth: _ScreenUnits = ..., selectforeground: str = ..., state: Literal["normal", "disabled", "readonly"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., @@ -3947,10 +3950,10 @@ class LabelFrame(Widget): cnf: dict[str, Any] | None = {}, *, background: str = ..., - bd: float | str = 2, + bd: _ScreenUnits = 2, bg: str = ..., - border: float | str = 2, - borderwidth: float | str = 2, + border: _ScreenUnits = 2, + borderwidth: _ScreenUnits = 2, class_: str = "Labelframe", # can't be changed with configure() colormap: Literal["new", ""] | Misc = "", # can't be changed with configure() container: bool = False, # undocumented, can't be changed with configure() @@ -3958,21 +3961,21 @@ class LabelFrame(Widget): fg: str = ..., font: _FontDescription = "TkDefaultFont", foreground: str = ..., - height: float | str = 0, + height: _ScreenUnits = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = 0, + highlightthickness: _ScreenUnits = 0, # 'ne' and 'en' are valid labelanchors, but only 'ne' is a valid _Anchor. labelanchor: Literal["nw", "n", "ne", "en", "e", "es", "se", "s", "sw", "ws", "w", "wn"] = "nw", labelwidget: Misc = ..., name: str = ..., - padx: float | str = 0, - pady: float | str = 0, + padx: _ScreenUnits = 0, + pady: _ScreenUnits = 0, relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "groove", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = 0, text: float | str = "", visual: str | tuple[str, int] = "", # can't be changed with configure() - width: float | str = 0, + width: _ScreenUnits = 0, ) -> None: ... @overload def configure( @@ -3980,26 +3983,26 @@ class LabelFrame(Widget): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: float | str = ..., + height: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = ..., + highlightthickness: _ScreenUnits = ..., labelanchor: Literal["nw", "n", "ne", "en", "e", "es", "se", "s", "sw", "ws", "w", "wn"] = ..., labelwidget: Misc = ..., - padx: float | str = ..., - pady: float | str = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = ..., - width: float | str = ..., + width: _ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -4012,27 +4015,27 @@ class PanedWindow(Widget): cnf: dict[str, Any] | None = {}, *, background: str = ..., - bd: float | str = 1, + bd: _ScreenUnits = 1, bg: str = ..., - border: float | str = 1, - borderwidth: float | str = 1, + border: _ScreenUnits = 1, + borderwidth: _ScreenUnits = 1, cursor: _Cursor = "", - handlepad: float | str = 8, - handlesize: float | str = 8, - height: float | str = "", + handlepad: _ScreenUnits = 8, + handlesize: _ScreenUnits = 8, + height: _ScreenUnits = "", name: str = ..., opaqueresize: bool = True, orient: Literal["horizontal", "vertical"] = "horizontal", proxybackground: str = "", - proxyborderwidth: float | str = 2, + proxyborderwidth: _ScreenUnits = 2, proxyrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", sashcursor: _Cursor = "", - sashpad: float | str = 0, + sashpad: _ScreenUnits = 0, sashrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", - sashwidth: float | str = 3, + sashwidth: _ScreenUnits = 3, showhandle: bool = False, - width: float | str = "", + width: _ScreenUnits = "", ) -> None: ... @overload def configure( @@ -4040,26 +4043,26 @@ class PanedWindow(Widget): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: float | str = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = ..., - handlepad: float | str = ..., - handlesize: float | str = ..., - height: float | str = ..., + handlepad: _ScreenUnits = ..., + handlesize: _ScreenUnits = ..., + height: _ScreenUnits = ..., opaqueresize: bool = ..., orient: Literal["horizontal", "vertical"] = ..., proxybackground: str = ..., - proxyborderwidth: float | str = ..., + proxyborderwidth: _ScreenUnits = ..., proxyrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., sashcursor: _Cursor = ..., - sashpad: float | str = ..., + sashpad: _ScreenUnits = ..., sashrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., - sashwidth: float | str = ..., + sashwidth: _ScreenUnits = ..., showhandle: bool = ..., - width: float | str = ..., + width: _ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... diff --git a/stdlib/tkinter/ttk.pyi b/stdlib/tkinter/ttk.pyi index 1e9562808201..dcb344c612a0 100644 --- a/stdlib/tkinter/ttk.pyi +++ b/stdlib/tkinter/ttk.pyi @@ -39,12 +39,11 @@ def tclobjs_to_py(adict: dict[Any, Any]) -> dict[Any, Any]: ... def setup_master(master: tkinter.Misc | None = None): ... _Padding: TypeAlias = ( - float - | str - | tuple[float | str] - | tuple[float | str, float | str] - | tuple[float | str, float | str, float | str] - | tuple[float | str, float | str, float | str, float | str] + tkinter._ScreenUnits + | tuple[tkinter._ScreenUnits] + | tuple[tkinter._ScreenUnits, tkinter._ScreenUnits] + | tuple[tkinter._ScreenUnits, tkinter._ScreenUnits, tkinter._ScreenUnits] + | tuple[tkinter._ScreenUnits, tkinter._ScreenUnits, tkinter._ScreenUnits, tkinter._ScreenUnits] ) # from ttk_widget (aka ttk::widget) manual page, differs from compound @@ -70,10 +69,10 @@ _LayoutSpec: TypeAlias = list[tuple[str, _Layout | None]] # Keep these in sync with the appropriate methods in Style class _ElementCreateImageKwargs(TypedDict, total=False): border: _Padding - height: float | str + height: tkinter._ScreenUnits padding: _Padding sticky: str - width: float | str + width: tkinter._ScreenUnits _ElementCreateArgsCrossPlatform: TypeAlias = ( # Could be any sequence here but types are not homogenous so just type it as tuple @@ -89,8 +88,8 @@ if sys.platform == "win32" and sys.version_info >= (3, 13): padding: _Padding class _ElementCreateVsapiKwargsSize(TypedDict): - width: float | str - height: float | str + width: tkinter._ScreenUnits + height: tkinter._ScreenUnits _ElementCreateVsapiKwargsDict: TypeAlias = ( _ElementCreateVsapiKwargsPadding | _ElementCreateVsapiKwargsMargin | _ElementCreateVsapiKwargsSize @@ -144,10 +143,10 @@ class Style: /, *imagespec: _ImageStatespec, border: _Padding = ..., - height: float | str = ..., + height: tkinter._ScreenUnits = ..., padding: _Padding = ..., sticky: str = ..., - width: float | str = ..., + width: tkinter._ScreenUnits = ..., ) -> None: ... @overload def element_create(self, elementname: str, etype: Literal["from"], themename: str, fromelement: str = ..., /) -> None: ... @@ -189,8 +188,8 @@ class Style: vs_statespec: _VsapiStatespec = ..., /, *, - width: float | str, - height: float | str, + width: tkinter._ScreenUnits, + height: tkinter._ScreenUnits, ) -> None: ... def element_names(self) -> tuple[str, ...]: ... @@ -476,32 +475,32 @@ class Frame(Widget): self, master: tkinter.Misc | None = None, *, - border: float | str = ..., - borderwidth: float | str = ..., + border: tkinter._ScreenUnits = ..., + borderwidth: tkinter._ScreenUnits = ..., class_: str = "", cursor: tkinter._Cursor = "", - height: float | str = 0, + height: tkinter._ScreenUnits = 0, name: str = ..., padding: _Padding = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., style: str = "", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", - width: float | str = 0, + width: tkinter._ScreenUnits = 0, ) -> None: ... @overload def configure( self, cnf: dict[str, Any] | None = None, *, - border: float | str = ..., - borderwidth: float | str = ..., + border: tkinter._ScreenUnits = ..., + borderwidth: tkinter._ScreenUnits = ..., cursor: tkinter._Cursor = ..., - height: float | str = ..., + height: tkinter._ScreenUnits = ..., padding: _Padding = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., style: str = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., - width: float | str = ..., + width: tkinter._ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -514,8 +513,8 @@ class Label(Widget): *, anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., background: str = "", - border: float | str = ..., # alias for borderwidth - borderwidth: float | str = ..., # undocumented + border: tkinter._ScreenUnits = ..., # alias for borderwidth + borderwidth: tkinter._ScreenUnits = ..., # undocumented class_: str = "", compound: _TtkCompound = "", cursor: tkinter._Cursor = "", @@ -533,7 +532,7 @@ class Label(Widget): textvariable: tkinter.Variable = ..., underline: int = -1, width: int | Literal[""] = "", - wraplength: float | str = ..., + wraplength: tkinter._ScreenUnits = ..., ) -> None: ... @overload def configure( @@ -542,8 +541,8 @@ class Label(Widget): *, anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., background: str = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: tkinter._ScreenUnits = ..., + borderwidth: tkinter._ScreenUnits = ..., compound: _TtkCompound = ..., cursor: tkinter._Cursor = ..., font: _FontDescription = ..., @@ -559,7 +558,7 @@ class Label(Widget): textvariable: tkinter.Variable = ..., underline: int = ..., width: int | Literal[""] = ..., - wraplength: float | str = ..., + wraplength: tkinter._ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -570,11 +569,11 @@ class Labelframe(Widget): self, master: tkinter.Misc | None = None, *, - border: float | str = ..., - borderwidth: float | str = ..., # undocumented + border: tkinter._ScreenUnits = ..., + borderwidth: tkinter._ScreenUnits = ..., # undocumented class_: str = "", cursor: tkinter._Cursor = "", - height: float | str = 0, + height: tkinter._ScreenUnits = 0, labelanchor: Literal["nw", "n", "ne", "en", "e", "es", "se", "s", "sw", "ws", "w", "wn"] = ..., labelwidget: tkinter.Misc = ..., name: str = ..., @@ -584,17 +583,17 @@ class Labelframe(Widget): takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", text: float | str = "", underline: int = -1, - width: float | str = 0, + width: tkinter._ScreenUnits = 0, ) -> None: ... @overload def configure( self, cnf: dict[str, Any] | None = None, *, - border: float | str = ..., - borderwidth: float | str = ..., + border: tkinter._ScreenUnits = ..., + borderwidth: tkinter._ScreenUnits = ..., cursor: tkinter._Cursor = ..., - height: float | str = ..., + height: tkinter._ScreenUnits = ..., labelanchor: Literal["nw", "n", "ne", "en", "e", "es", "se", "s", "sw", "ws", "w", "wn"] = ..., labelwidget: tkinter.Misc = ..., padding: _Padding = ..., @@ -603,7 +602,7 @@ class Labelframe(Widget): takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., text: float | str = ..., underline: int = ..., - width: float | str = ..., + width: tkinter._ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -765,7 +764,7 @@ class Progressbar(Widget): *, class_: str = "", cursor: tkinter._Cursor = "", - length: float | str = 100, + length: tkinter._ScreenUnits = 100, maximum: float = 100, mode: Literal["determinate", "indeterminate"] = "determinate", name: str = ..., @@ -782,7 +781,7 @@ class Progressbar(Widget): cnf: dict[str, Any] | None = None, *, cursor: tkinter._Cursor = ..., - length: float | str = ..., + length: tkinter._ScreenUnits = ..., maximum: float = ..., mode: Literal["determinate", "indeterminate"] = ..., orient: Literal["horizontal", "vertical"] = ..., @@ -856,7 +855,7 @@ class Scale(Widget, tkinter.Scale): # type: ignore[misc] command: str | Callable[[str], object] = "", cursor: tkinter._Cursor = "", from_: float = 0, - length: float | str = 100, + length: tkinter._ScreenUnits = 100, name: str = ..., orient: Literal["horizontal", "vertical"] = "horizontal", state: str = ..., # undocumented @@ -874,7 +873,7 @@ class Scale(Widget, tkinter.Scale): # type: ignore[misc] command: str | Callable[[str], object] = ..., cursor: tkinter._Cursor = ..., from_: float = ..., - length: float | str = ..., + length: tkinter._ScreenUnits = ..., orient: Literal["horizontal", "vertical"] = ..., state: str = ..., style: str = ..., @@ -894,7 +893,7 @@ class Scale(Widget, tkinter.Scale): # type: ignore[misc] command: str | Callable[[str], object] = ..., cursor: tkinter._Cursor = ..., from_: float = ..., - length: float | str = ..., + length: tkinter._ScreenUnits = ..., orient: Literal["horizontal", "vertical"] = ..., state: str = ..., style: str = ..., @@ -1314,18 +1313,18 @@ class LabeledScale(Frame): from_: float = 0, to: float = 10, *, - border: float | str = ..., - borderwidth: float | str = ..., + border: tkinter._ScreenUnits = ..., + borderwidth: tkinter._ScreenUnits = ..., class_: str = "", compound: Literal["top", "bottom"] = "top", cursor: tkinter._Cursor = "", - height: float | str = 0, + height: tkinter._ScreenUnits = 0, name: str = ..., padding: _Padding = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., style: str = "", takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = "", - width: float | str = 0, + width: tkinter._ScreenUnits = 0, ) -> None: ... # destroy is overridden, signature does not change value: Any diff --git a/stubs/ttkthemes/ttkthemes/themed_tk.pyi b/stubs/ttkthemes/ttkthemes/themed_tk.pyi index 3d749ebbee37..695d8f275382 100644 --- a/stubs/ttkthemes/ttkthemes/themed_tk.pyi +++ b/stubs/ttkthemes/ttkthemes/themed_tk.pyi @@ -32,21 +32,21 @@ class ThemedTk(tkinter.Tk, ThemedWidget): toplevel: bool | None = ..., theme: str | None = ..., background: str = ..., - bd: float | str = ..., + bd: tkinter._ScreenUnits = ..., bg: str = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: tkinter._ScreenUnits = ..., + borderwidth: tkinter._ScreenUnits = ..., cursor: tkinter._Cursor = ..., - height: float | str = ..., + height: tkinter._ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = ..., + highlightthickness: tkinter._ScreenUnits = ..., menu: tkinter.Menu = ..., - padx: float | str = ..., - pady: float | str = ..., + padx: tkinter._ScreenUnits = ..., + pady: tkinter._ScreenUnits = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., - width: float | str = ..., + width: tkinter._ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... def cget(self, k: str) -> Any: ... def configure( # type: ignore[override] @@ -57,21 +57,21 @@ class ThemedTk(tkinter.Tk, ThemedWidget): toplevel: bool | None = ..., theme: str | None = ..., background: str = ..., - bd: float | str = ..., + bd: tkinter._ScreenUnits = ..., bg: str = ..., - border: float | str = ..., - borderwidth: float | str = ..., + border: tkinter._ScreenUnits = ..., + borderwidth: tkinter._ScreenUnits = ..., cursor: tkinter._Cursor = ..., - height: float | str = ..., + height: tkinter._ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: float | str = ..., + highlightthickness: tkinter._ScreenUnits = ..., menu: tkinter.Menu = ..., - padx: float | str = ..., - pady: float | str = ..., + padx: tkinter._ScreenUnits = ..., + pady: tkinter._ScreenUnits = ..., relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., takefocus: bool | Literal[0, 1, ""] | Callable[[str], bool | None] = ..., - width: float | str = ..., + width: tkinter._ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... def __getitem__(self, k: str) -> Any: ... def __setitem__(self, k: str, v: Any) -> None: ... From fbde2d8d46b69c8402859bde0d0d12d82f01ecbc Mon Sep 17 00:00:00 2001 From: donBarbos Date: Tue, 23 Sep 2025 22:34:17 +0400 Subject: [PATCH 4/4] Clear revert --- stdlib/tkinter/__init__.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 08d867dc7bc0..0ca877ecb995 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -1262,7 +1262,7 @@ class Button(Widget): font: _FontDescription = "TkDefaultFont", foreground: str = ..., # width and height must be int for buttons containing just text, but - # buttons with an image accept any screen units. + # ints are also valid _ScreenUnits height: _ScreenUnits = 0, highlightbackground: str = ..., highlightcolor: str = ..., @@ -1351,7 +1351,7 @@ class Canvas(Widget, XView, YView): cursor: _Cursor = "", # canvas manual page has a section named COORDINATES, and the first # part of it describes _ScreenUnits. - height: _ScreenUnits = ..., # see COORDINATES in canvas manual page + height: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., highlightthickness: _ScreenUnits = ...,