From 363e51575890e2bec156c9426a048704608c0313 Mon Sep 17 00:00:00 2001 From: donBarbos Date: Sat, 23 Aug 2025 16:11:13 +0400 Subject: [PATCH 1/5] [tkinter] Small improvements --- stdlib/_tkinter.pyi | 40 ++++++------- stdlib/tkinter/__init__.pyi | 112 ++++++++++++++++++------------------ 2 files changed, 76 insertions(+), 76 deletions(-) diff --git a/stdlib/_tkinter.pyi b/stdlib/_tkinter.pyi index 46366ccc1740..a3868f467c6c 100644 --- a/stdlib/_tkinter.pyi +++ b/stdlib/_tkinter.pyi @@ -54,34 +54,34 @@ _TkinterTraceFunc: TypeAlias = Callable[[tuple[str, ...]], object] @final class TkappType: # Please keep in sync with tkinter.Tk - def adderrorinfo(self, msg, /): ... + def adderrorinfo(self, msg: str, /): ... def call(self, command: Any, /, *args: Any) -> Any: ... - def createcommand(self, name, func, /): ... + def createcommand(self, name: str, func, /): ... if sys.platform != "win32": - def createfilehandler(self, file, mask, func, /): ... - def deletefilehandler(self, file, /): ... + def createfilehandler(self, file, mask: int, func, /): ... + def deletefilehandler(self, file, /) -> None: ... - def createtimerhandler(self, milliseconds, func, /): ... - def deletecommand(self, name, /): ... + def createtimerhandler(self, milliseconds: int, func, /): ... + def deletecommand(self, name: str, /): ... def dooneevent(self, flags: int = 0, /): ... def eval(self, script: str, /) -> str: ... - def evalfile(self, fileName, /): ... - def exprboolean(self, s, /): ... - def exprdouble(self, s, /): ... - def exprlong(self, s, /): ... - def exprstring(self, s, /): ... - def getboolean(self, arg, /): ... - def getdouble(self, arg, /): ... - def getint(self, arg, /): ... + def evalfile(self, fileName: str, /): ... + def exprboolean(self, s: str, /): ... + def exprdouble(self, s: str, /): ... + def exprlong(self, s: str, /): ... + def exprstring(self, s: str, /): ... + def getboolean(self, arg, /) -> bool: ... + def getdouble(self, arg, /) -> float: ... + def getint(self, arg, /) -> int: ... def getvar(self, *args, **kwargs): ... def globalgetvar(self, *args, **kwargs): ... def globalsetvar(self, *args, **kwargs): ... def globalunsetvar(self, *args, **kwargs): ... def interpaddr(self) -> int: ... def loadtk(self) -> None: ... - def mainloop(self, threshold: int = 0, /): ... - def quit(self): ... - def record(self, script, /): ... + def mainloop(self, threshold: int = 0, /) -> None: ... + def quit(self) -> None: ... + def record(self, script: str, /): ... def setvar(self, *ags, **kwargs): ... if sys.version_info < (3, 11): @deprecated("Deprecated since Python 3.9; removed in Python 3.11. Use `splitlist()` instead.") @@ -90,7 +90,7 @@ class TkappType: def splitlist(self, arg, /): ... def unsetvar(self, *args, **kwargs): ... def wantobjects(self, *args, **kwargs): ... - def willdispatch(self): ... + def willdispatch(self) -> None: ... if sys.version_info >= (3, 12): def gettrace(self, /) -> _TkinterTraceFunc | None: ... def settrace(self, func: _TkinterTraceFunc | None, /) -> None: ... @@ -140,5 +140,5 @@ else: /, ): ... -def getbusywaitinterval(): ... -def setbusywaitinterval(new_val, /): ... +def getbusywaitinterval() -> int: ... +def setbusywaitinterval(new_val: int, /) -> None: ... diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 3467f86cc5ee..fb5b5f5cd163 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -176,6 +176,7 @@ EXCEPTION: Final = _tkinter.EXCEPTION # 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 +_JustifyValue: TypeAlias = Literal["left", "center", "right"] # manual page: Tk_GetJustify _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 @@ -329,12 +330,12 @@ class Variable: @deprecated("Deprecated since Python 3.14. Use `trace_remove()` instead.") def trace_vdelete(self, mode, cbname) -> None: ... @deprecated("Deprecated since Python 3.14. Use `trace_info()` instead.") - def trace_vinfo(self): ... + def trace_vinfo(self) -> list[Incomplete]: ... else: def trace(self, mode, callback) -> str: ... def trace_variable(self, mode, callback) -> str: ... def trace_vdelete(self, mode, cbname) -> None: ... - def trace_vinfo(self): ... + def trace_vinfo(self) -> list[Incomplete]: ... def __eq__(self, other: object) -> bool: ... def __del__(self) -> None: ... @@ -369,7 +370,7 @@ def mainloop(n: int = 0) -> None: ... getint = int getdouble = float -def getboolean(s): ... +def getboolean(s) -> bool: ... _Ts = TypeVarTuple("_Ts") @@ -399,9 +400,9 @@ class Misc: def wait_visibility(self, window: Misc | None = None) -> None: ... def setvar(self, name: str = "PY_VAR", value: str = "1") -> None: ... def getvar(self, name: str = "PY_VAR"): ... - def getint(self, s): ... - def getdouble(self, s): ... - def getboolean(self, s): ... + def getint(self, s) -> int: ... + def getdouble(self, s) -> float: ... + def getboolean(self, s) -> bool: ... def focus_set(self) -> None: ... focus = focus_set def focus_force(self) -> None: ... @@ -440,7 +441,7 @@ class Misc: def tk_busy_status(self) -> bool: ... busy_status = tk_busy_status - def clipboard_get(self, *, displayof: Misc = ..., type: str = ...) -> str: ... + def clipboard_get(self, *, displayof: Misc = ..., type: str = "UTF8_STRING") -> str: ... def clipboard_clear(self, *, displayof: Misc = ...) -> None: ... def clipboard_append(self, string: str, *, displayof: Misc = ..., format: str = ..., type: str = ...) -> None: ... def grab_current(self): ... @@ -677,7 +678,7 @@ class XView: @overload def xview(self) -> tuple[float, float]: ... @overload - def xview(self, *args): ... + def xview(self, *args) -> None: ... def xview_moveto(self, fraction: float) -> None: ... @overload def xview_scroll(self, number: int, what: Literal["units", "pages"]) -> None: ... @@ -688,7 +689,7 @@ class YView: @overload def yview(self) -> tuple[float, float]: ... @overload - def yview(self, *args): ... + def yview(self, *args) -> None: ... def yview_moveto(self, fraction: float) -> None: ... @overload def yview_scroll(self, number: int, what: Literal["units", "pages"]) -> None: ... @@ -1014,27 +1015,27 @@ class Tk(Misc, Wm): # Tk has __getattr__ so that tk_instance.foo falls back to tk_instance.tk.foo # Please keep in sync with _tkinter.TkappType. # Some methods are intentionally missing because they are inherited from Misc instead. - def adderrorinfo(self, msg, /): ... + def adderrorinfo(self, msg: str, /): ... def call(self, command: Any, /, *args: Any) -> Any: ... - def createcommand(self, name, func, /): ... + def createcommand(self, name: str, func, /): ... if sys.platform != "win32": - def createfilehandler(self, file, mask, func, /): ... - def deletefilehandler(self, file, /): ... + def createfilehandler(self, file, mask: int, func, /): ... + def deletefilehandler(self, file, /) -> None: ... - def createtimerhandler(self, milliseconds, func, /): ... - def dooneevent(self, flags: int = ..., /): ... + def createtimerhandler(self, milliseconds: int, func, /): ... + def dooneevent(self, flags: int = 0, /): ... def eval(self, script: str, /) -> str: ... - def evalfile(self, fileName, /): ... - def exprboolean(self, s, /): ... - def exprdouble(self, s, /): ... - def exprlong(self, s, /): ... - def exprstring(self, s, /): ... + def evalfile(self, fileName: str, /): ... + def exprboolean(self, s: str, /): ... + def exprdouble(self, s: str, /): ... + def exprlong(self, s: str, /): ... + def exprstring(self, s: str, /): ... def globalgetvar(self, *args, **kwargs): ... def globalsetvar(self, *args, **kwargs): ... def globalunsetvar(self, *args, **kwargs): ... def interpaddr(self) -> int: ... def loadtk(self) -> None: ... - def record(self, script, /): ... + def record(self, script: str, /): ... if sys.version_info < (3, 11): @deprecated("Deprecated since Python 3.9; removed in Python 3.11. Use `splitlist()` instead.") def split(self, arg, /): ... @@ -1042,7 +1043,7 @@ class Tk(Misc, Wm): def splitlist(self, arg, /): ... def unsetvar(self, *args, **kwargs): ... def wantobjects(self, *args, **kwargs): ... - def willdispatch(self): ... + def willdispatch(self) -> None: ... def Tcl(screenName: str | None = None, baseName: str | None = None, className: str = "Tk", useTk: bool = False) -> Tk: ... @@ -1166,8 +1167,8 @@ class Grid: class BaseWidget(Misc): master: Misc - widgetName: Incomplete - def __init__(self, master, widgetName, cnf={}, kw={}, extra=()) -> None: ... + widgetName: str + def __init__(self, master, widgetName: str, cnf={}, kw={}, extra=()) -> None: ... def destroy(self) -> None: ... # This class represents any widget except Toplevel or Tk. @@ -1276,7 +1277,7 @@ class Button(Widget): highlightcolor: str = ..., highlightthickness: _ScreenUnits = 1, image: _ImageSpec = "", - justify: Literal["left", "center", "right"] = "center", + justify: _JustifyValue = "center", name: str = ..., overrelief: _Relief | Literal[""] = "", padx: _ScreenUnits = ..., @@ -1322,7 +1323,7 @@ class Button(Widget): highlightcolor: str = ..., highlightthickness: _ScreenUnits = ..., image: _ImageSpec = ..., - justify: Literal["left", "center", "right"] = ..., + justify: _JustifyValue = ..., overrelief: _Relief | Literal[""] = ..., padx: _ScreenUnits = ..., pady: _ScreenUnits = ..., @@ -1901,7 +1902,7 @@ class Canvas(Widget, XView, YView): disabledstipple: str = ..., fill: str = ..., font: _FontDescription = ..., - justify: Literal["left", "center", "right"] = ..., + justify: _JustifyValue = ..., offset: _ScreenUnits = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., @@ -1923,7 +1924,7 @@ class Canvas(Widget, XView, YView): disabledstipple: str = ..., fill: str = ..., font: _FontDescription = ..., - justify: Literal["left", "center", "right"] = ..., + justify: _JustifyValue = ..., offset: _ScreenUnits = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., @@ -2028,7 +2029,7 @@ class Checkbutton(Widget): highlightthickness: _ScreenUnits = 1, image: _ImageSpec = "", indicatoron: bool = True, - justify: Literal["left", "center", "right"] = "center", + justify: _JustifyValue = "center", name: str = ..., offrelief: _Relief = ..., # The checkbutton puts a value to its variable when it's checked or @@ -2087,7 +2088,7 @@ class Checkbutton(Widget): highlightthickness: _ScreenUnits = ..., image: _ImageSpec = ..., indicatoron: bool = ..., - justify: Literal["left", "center", "right"] = ..., + justify: _JustifyValue = ..., offrelief: _Relief = ..., offvalue: Any = ..., onvalue: Any = ..., @@ -2145,7 +2146,7 @@ class Entry(Widget, XView): insertwidth: _ScreenUnits = ..., invalidcommand: _EntryValidateCommand = "", invcmd: _EntryValidateCommand = "", # same as invalidcommand - justify: Literal["left", "center", "right"] = "left", + justify: _JustifyValue = "left", name: str = ..., readonlybackground: str = ..., relief: _Relief = "sunken", @@ -2189,7 +2190,7 @@ class Entry(Widget, XView): insertwidth: _ScreenUnits = ..., invalidcommand: _EntryValidateCommand = ..., invcmd: _EntryValidateCommand = ..., - justify: Literal["left", "center", "right"] = ..., + justify: _JustifyValue = ..., readonlybackground: str = ..., relief: _Relief = ..., selectbackground: str = ..., @@ -2306,7 +2307,7 @@ class Label(Widget): highlightcolor: str = ..., highlightthickness: _ScreenUnits = 0, image: _ImageSpec = "", - justify: Literal["left", "center", "right"] = "center", + justify: _JustifyValue = "center", name: str = ..., padx: _ScreenUnits = 1, pady: _ScreenUnits = 1, @@ -2344,7 +2345,7 @@ class Label(Widget): highlightcolor: str = ..., highlightthickness: _ScreenUnits = ..., image: _ImageSpec = ..., - justify: Literal["left", "center", "right"] = ..., + justify: _JustifyValue = ..., padx: _ScreenUnits = ..., pady: _ScreenUnits = ..., relief: _Relief = ..., @@ -2382,7 +2383,7 @@ class Listbox(Widget, XView, YView): highlightbackground: str = ..., highlightcolor: str = ..., highlightthickness: _ScreenUnits = ..., - justify: Literal["left", "center", "right"] = "left", + justify: _JustifyValue = "left", # There's no tkinter.ListVar, but seems like bare tkinter.Variable # actually works for this: # @@ -2433,7 +2434,7 @@ class Listbox(Widget, XView, YView): highlightbackground: str = ..., highlightcolor: str = ..., highlightthickness: _ScreenUnits = ..., - justify: Literal["left", "center", "right"] = ..., + justify: _JustifyValue = ..., listvariable: Variable = ..., relief: _Relief = ..., selectbackground: str = ..., @@ -2772,7 +2773,7 @@ class Menubutton(Widget): highlightthickness: _ScreenUnits = 0, image: _ImageSpec = "", indicatoron: bool = ..., - justify: Literal["left", "center", "right"] = ..., + justify: _JustifyValue = ..., menu: Menu = ..., name: str = ..., padx: _ScreenUnits = ..., @@ -2813,7 +2814,7 @@ class Menubutton(Widget): highlightthickness: _ScreenUnits = ..., image: _ImageSpec = ..., indicatoron: bool = ..., - justify: Literal["left", "center", "right"] = ..., + justify: _JustifyValue = ..., menu: Menu = ..., padx: _ScreenUnits = ..., pady: _ScreenUnits = ..., @@ -2850,7 +2851,7 @@ class Message(Widget): highlightbackground: str = ..., highlightcolor: str = ..., highlightthickness: _ScreenUnits = 0, - justify: Literal["left", "center", "right"] = "left", + justify: _JustifyValue = "left", name: str = ..., padx: _ScreenUnits = ..., pady: _ScreenUnits = ..., @@ -2880,7 +2881,7 @@ class Message(Widget): highlightbackground: str = ..., highlightcolor: str = ..., highlightthickness: _ScreenUnits = ..., - justify: Literal["left", "center", "right"] = ..., + justify: _JustifyValue = ..., padx: _ScreenUnits = ..., pady: _ScreenUnits = ..., relief: _Relief = ..., @@ -2921,7 +2922,7 @@ class Radiobutton(Widget): highlightthickness: _ScreenUnits = 1, image: _ImageSpec = "", indicatoron: bool = True, - justify: Literal["left", "center", "right"] = "center", + justify: _JustifyValue = "center", name: str = ..., offrelief: _Relief = ..., overrelief: _Relief | Literal[""] = "", @@ -2969,7 +2970,7 @@ class Radiobutton(Widget): highlightthickness: _ScreenUnits = ..., image: _ImageSpec = ..., indicatoron: bool = ..., - justify: Literal["left", "center", "right"] = ..., + justify: _JustifyValue = ..., offrelief: _Relief = ..., overrelief: _Relief | Literal[""] = ..., padx: _ScreenUnits = ..., @@ -3555,7 +3556,7 @@ class Text(Widget, XView, YView): fgstipple: str = ..., font: _FontDescription = ..., foreground: str = ..., - justify: Literal["left", "right", "center"] = ..., + justify: _JustifyValue = ..., lmargin1: _ScreenUnits = ..., lmargin2: _ScreenUnits = ..., lmargincolor: str = ..., @@ -3639,7 +3640,6 @@ class _setit: # manual page: tk_optionMenu class OptionMenu(Menubutton): - widgetName: Incomplete menuname: Incomplete def __init__( # differs from other widgets @@ -3851,7 +3851,7 @@ class Spinbox(Widget, XView): insertwidth: _ScreenUnits = ..., invalidcommand: _EntryValidateCommand = "", invcmd: _EntryValidateCommand = "", - justify: Literal["left", "center", "right"] = "left", + justify: _JustifyValue = "left", name: str = ..., readonlybackground: str = ..., relief: _Relief = "sunken", @@ -3908,7 +3908,7 @@ class Spinbox(Widget, XView): insertwidth: _ScreenUnits = ..., invalidcommand: _EntryValidateCommand = ..., invcmd: _EntryValidateCommand = ..., - justify: Literal["left", "center", "right"] = ..., + justify: _JustifyValue = ..., readonlybackground: str = ..., relief: _Relief = ..., repeatdelay: int = ..., @@ -4078,19 +4078,19 @@ class PanedWindow(Widget): config = configure def add(self, child: Widget, **kw) -> None: ... def remove(self, child) -> None: ... - forget: Incomplete + forget = remove def identify(self, x: int, y: int): ... - def proxy(self, *args): ... - def proxy_coord(self): ... - def proxy_forget(self): ... - def proxy_place(self, x, y): ... - def sash(self, *args): ... - def sash_coord(self, index): ... - def sash_mark(self, index): ... - def sash_place(self, index, x, y): ... + def proxy(self, *args) -> tuple[Incomplete, ...]: ... + def proxy_coord(self) -> tuple[Incomplete, ...]: ... + def proxy_forget(self) -> tuple[Incomplete, ...]: ... + def proxy_place(self, x, y) -> tuple[Incomplete, ...]: ... + def sash(self, *args) -> tuple[Incomplete, ...]: ... + def sash_coord(self, index) -> tuple[Incomplete, ...]: ... + def sash_mark(self, index) -> tuple[Incomplete, ...]: ... + def sash_place(self, index, x, y) -> tuple[Incomplete, ...]: ... def panecget(self, child, option): ... def paneconfigure(self, tagOrId, cnf=None, **kw): ... - paneconfig: Incomplete + paneconfig = paneconfigure def panes(self): ... def _test() -> None: ... From ec307c7633e07ef80f30de8b393d21a162498418 Mon Sep 17 00:00:00 2001 From: donBarbos Date: Sat, 23 Aug 2025 16:43:47 +0400 Subject: [PATCH 2/5] Ignore assignment error --- stdlib/tkinter/__init__.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index fb5b5f5cd163..a72a0fc4f0f1 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -4078,7 +4078,7 @@ class PanedWindow(Widget): config = configure def add(self, child: Widget, **kw) -> None: ... def remove(self, child) -> None: ... - forget = remove + forget = remove # type: ignore[assignment] def identify(self, x: int, y: int): ... def proxy(self, *args) -> tuple[Incomplete, ...]: ... def proxy_coord(self) -> tuple[Incomplete, ...]: ... From 63b21711cbc0a8de86aefb70b431221fdbfaebb8 Mon Sep 17 00:00:00 2001 From: donBarbos Date: Sun, 24 Aug 2025 17:45:21 +0400 Subject: [PATCH 3/5] get rid of few aliases --- stdlib/tkinter/__init__.pyi | 1244 +++++++++++------------ stdlib/tkinter/ttk.pyi | 169 +-- stubs/ttkthemes/ttkthemes/themed_tk.pyi | 38 +- 3 files changed, 720 insertions(+), 731 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index a72a0fc4f0f1..38784a94d348 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -175,19 +175,10 @@ EXCEPTION: Final = _tkinter.EXCEPTION # 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 -_JustifyValue: TypeAlias = Literal["left", "center", "right"] # manual page: Tk_GetJustify -_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): @@ -376,8 +367,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 @@ -441,7 +432,7 @@ class Misc: def tk_busy_status(self) -> bool: ... busy_status = tk_busy_status - def clipboard_get(self, *, displayof: Misc = ..., type: str = "UTF8_STRING") -> str: ... + def clipboard_get(self, *, displayof: Misc = ..., type: str = ...) -> str: ... def clipboard_clear(self, *, displayof: Misc = ...) -> None: ... def clipboard_append(self, string: str, *, displayof: Misc = ..., format: str = ..., type: str = ...) -> None: ... def grab_current(self): ... @@ -476,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: _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: ... @@ -486,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: _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: ... @@ -577,7 +568,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( @@ -593,8 +584,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 @@ -603,14 +594,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 @@ -629,32 +620,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, ...]: ... @@ -683,7 +674,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 @@ -694,7 +685,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 @@ -990,21 +981,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 = ..., + padx: str | float = ..., + pady: str | float = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., takefocus: _TakeFocusValue = ..., - 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]: ... @@ -1053,11 +1044,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 str or float # can be specified in pack(). ipadx: int ipady: int @@ -1065,8 +1056,8 @@ class _PackInfo(_InMiscTotal): pady: int | tuple[int, int] 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 + # _PackInfo is not the valid type for cnf because pad stuff accepts 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( @@ -1074,15 +1065,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: ... @@ -1094,7 +1085,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 @@ -1110,12 +1101,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 = ..., @@ -1150,10 +1141,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 @@ -1198,28 +1189,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, use: int = ..., visual: str | tuple[str, int] = "", - width: _ScreenUnits = 0, + width: str | float = 0, ) -> None: ... @overload def configure( @@ -1227,21 +1218,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 = ..., + padx: str | float = ..., + pady: str | float = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., takefocus: _TakeFocusValue = ..., - 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]: ... @@ -1255,15 +1246,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 = ..., @@ -1271,18 +1262,18 @@ 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 str | float + height: str | float = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = 1, - image: _ImageSpec = "", - justify: _JustifyValue = "center", + 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", @@ -1293,8 +1284,8 @@ class Button(Widget): # 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( @@ -1303,31 +1294,31 @@ 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 = ..., - justify: _JustifyValue = ..., - overrelief: _Relief | Literal[""] = ..., - padx: _ScreenUnits = ..., - pady: _ScreenUnits = ..., - relief: _Relief = ..., + highlightthickness: str | float = ..., + image: _Image | str = ..., + justify: Literal["left", "center", "right"] = ..., + 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"] = ..., @@ -1335,8 +1326,8 @@ class Button(Widget): 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]: ... @@ -1351,41 +1342,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 | float. + 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, + 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( @@ -1393,35 +1384,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 = ..., + 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]: ... @@ -1431,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: _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] @@ -1489,25 +1480,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( @@ -1519,25 +1510,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( @@ -1555,25 +1546,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( @@ -1589,24 +1580,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( @@ -1620,24 +1611,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( @@ -1657,24 +1648,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( @@ -1690,27 +1681,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( @@ -1724,27 +1715,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( @@ -1764,27 +1755,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( @@ -1800,24 +1791,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( @@ -1831,24 +1822,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( @@ -1868,24 +1859,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( @@ -1896,19 +1887,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: _JustifyValue = ..., - offset: _ScreenUnits = ..., + justify: Literal["left", "center", "right"] = ..., + 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( @@ -1918,19 +1909,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: _JustifyValue = ..., - offset: _ScreenUnits = ..., + justify: Literal["left", "center", "right"] = ..., + 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( @@ -1939,11 +1930,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 @@ -1952,11 +1943,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: ... @@ -1989,9 +1980,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: ... @@ -2009,29 +1998,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: _JustifyValue = "center", + 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. @@ -2044,22 +2033,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 = "", 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( @@ -2068,46 +2057,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: _JustifyValue = ..., - offrelief: _Relief = ..., + justify: Literal["left", "center", "right"] = ..., + 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 = ..., 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]: ... @@ -2125,10 +2114,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 = ..., @@ -2138,20 +2127,20 @@ 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 = ..., + insertwidth: str | float = ..., invalidcommand: _EntryValidateCommand = "", invcmd: _EntryValidateCommand = "", # same as invalidcommand - justify: _JustifyValue = "left", + 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", @@ -2161,7 +2150,7 @@ class Entry(Widget, XView): validatecommand: _EntryValidateCommand = "", vcmd: _EntryValidateCommand = "", # same as validatecommand width: int = 20, - xscrollcommand: _XYScrollCommand = "", + xscrollcommand: str | Callable[[float, float], object] = "", ) -> None: ... @overload def configure( @@ -2169,10 +2158,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 = ..., @@ -2182,19 +2171,19 @@ 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 = ..., + insertwidth: str | float = ..., invalidcommand: _EntryValidateCommand = ..., invcmd: _EntryValidateCommand = ..., - justify: _JustifyValue = ..., + 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"] = ..., @@ -2204,7 +2193,7 @@ class Entry(Widget, XView): validatecommand: _EntryValidateCommand = ..., vcmd: _EntryValidateCommand = ..., 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]: ... @@ -2236,25 +2225,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", + padx: str | float = 0, + pady: str | float = 0, + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", takefocus: _TakeFocusValue = 0, visual: str | tuple[str, int] = "", # can't be changed with configure() - width: _ScreenUnits = 0, + width: str | float = 0, ) -> None: ... @overload def configure( @@ -2262,20 +2251,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 = ..., + highlightthickness: str | float = ..., + padx: str | float = ..., + pady: str | float = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., takefocus: _TakeFocusValue = ..., - 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]: ... @@ -2289,36 +2278,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 = "", - justify: _JustifyValue = "center", + 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, 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( @@ -2327,35 +2316,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 = ..., - justify: _JustifyValue = ..., - padx: _ScreenUnits = ..., - pady: _ScreenUnits = ..., - relief: _Relief = ..., + highlightthickness: str | float = ..., + image: _Image | str = ..., + justify: Literal["left", "center", "right"] = ..., + padx: str | float = ..., + pady: str | float = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., state: Literal["normal", "active", "disabled"] = ..., takefocus: _TakeFocusValue = ..., 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]: ... @@ -2369,10 +2358,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, @@ -2382,8 +2371,8 @@ class Listbox(Widget, XView, YView): height: int = 10, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = ..., - justify: _JustifyValue = "left", + highlightthickness: str | float = ..., + justify: Literal["left", "center", "right"] = "left", # There's no tkinter.ListVar, but seems like bare tkinter.Variable # actually works for this: # @@ -2395,9 +2384,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, @@ -2410,8 +2399,8 @@ class Listbox(Widget, XView, YView): state: Literal["normal", "disabled"] = "normal", takefocus: _TakeFocusValue = "", width: int = 20, - xscrollcommand: _XYScrollCommand = "", - yscrollcommand: _XYScrollCommand = "", + xscrollcommand: str | Callable[[float, float], object] = "", + yscrollcommand: str | Callable[[float, float], object] = "", ) -> None: ... @overload def configure( @@ -2420,10 +2409,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 = ..., @@ -2433,20 +2422,20 @@ class Listbox(Widget, XView, YView): height: int = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: _ScreenUnits = ..., - justify: _JustifyValue = ..., + 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 = ..., 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]: ... @@ -2482,13 +2471,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 = ..., @@ -2496,7 +2485,7 @@ 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, tearoff: bool | Literal[0, 1] = 1, @@ -2513,20 +2502,20 @@ 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 = ..., tearoff: bool = ..., @@ -2552,11 +2541,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"] = ..., @@ -2573,17 +2562,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 = ..., @@ -2599,11 +2588,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 = ..., @@ -2619,15 +2608,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 = ..., @@ -2646,11 +2635,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"] = ..., @@ -2668,17 +2657,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 = ..., @@ -2695,11 +2684,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 = ..., @@ -2716,15 +2705,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 = ..., @@ -2753,39 +2742,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: _JustifyValue = ..., + 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, 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( @@ -2794,38 +2783,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: _JustifyValue = ..., + 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 = ..., 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]: ... @@ -2837,58 +2826,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, - justify: _JustifyValue = "left", + highlightthickness: str | float = 0, + justify: Literal["left", "center", "right"] = "left", name: str = ..., - padx: _ScreenUnits = ..., - pady: _ScreenUnits = ..., - relief: _Relief = "flat", + padx: str | float = ..., + pady: str | float = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", takefocus: _TakeFocusValue = 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 = ..., - justify: _JustifyValue = ..., - padx: _ScreenUnits = ..., - pady: _ScreenUnits = ..., - relief: _Relief = ..., + highlightthickness: str | float = ..., + justify: Literal["left", "center", "right"] = ..., + padx: str | float = ..., + pady: str | float = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., takefocus: _TakeFocusValue = ..., 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]: ... @@ -2902,46 +2891,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: _JustifyValue = "center", + 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 = "", 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( @@ -2950,45 +2939,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: _JustifyValue = ..., - offrelief: _Relief = ..., - overrelief: _Relief | Literal[""] = ..., - padx: _ScreenUnits = ..., - pady: _ScreenUnits = ..., - relief: _Relief = ..., + 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 = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., selectcolor: str = ..., - selectimage: _ImageSpec = ..., + selectimage: _Image | str = ..., state: Literal["normal", "active", "disabled"] = ..., takefocus: _TakeFocusValue = ..., 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]: ... @@ -3006,11 +2995,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 = "", @@ -3021,25 +3010,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 = "", tickinterval: float = 0.0, to: float = 100.0, troughcolor: str = ..., variable: IntVar | DoubleVar = ..., - width: _ScreenUnits = 15, + width: str | float = 15, ) -> None: ... @overload def configure( @@ -3048,11 +3037,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 = ..., @@ -3062,24 +3051,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 = ..., 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]: ... @@ -3096,31 +3085,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 = "", troughcolor: str = ..., - width: _ScreenUnits = ..., + width: str | float = ..., ) -> None: ... @overload def configure( @@ -3128,26 +3117,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 = ..., 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]: ... @@ -3172,11 +3161,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, @@ -3186,40 +3175,39 @@ 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 = "", 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( @@ -3228,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 = ..., 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]: ... @@ -3479,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, @@ -3490,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: ... @@ -3550,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: _JustifyValue = ..., - lmargin1: _ScreenUnits = ..., - lmargin2: _ScreenUnits = ..., + justify: Literal["left", "center", "right"] = ..., + 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 = ..., @@ -3613,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: ... @@ -3626,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: ... @@ -3821,14 +3809,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", @@ -3842,23 +3830,23 @@ 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 = ..., + insertwidth: str | float = ..., invalidcommand: _EntryValidateCommand = "", invcmd: _EntryValidateCommand = "", - justify: _JustifyValue = "left", + 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 = "", @@ -3870,7 +3858,7 @@ class Spinbox(Widget, XView): values: list[str] | tuple[str, ...] = ..., width: int = 20, wrap: bool = False, - xscrollcommand: _XYScrollCommand = "", + xscrollcommand: str | Callable[[float, float], object] = "", ) -> None: ... @overload def configure( @@ -3879,14 +3867,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 = ..., @@ -3899,22 +3887,22 @@ 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 = ..., + insertwidth: str | float = ..., invalidcommand: _EntryValidateCommand = ..., invcmd: _EntryValidateCommand = ..., - justify: _JustifyValue = ..., + 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 = ..., @@ -3926,7 +3914,7 @@ class Spinbox(Widget, XView): 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]: ... @@ -3959,10 +3947,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() @@ -3970,21 +3958,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, - # 'ne' and 'en' are valid labelanchors, but only 'ne' is a valid _Anchor. + highlightthickness: str | float = 0, + # 'ne' and 'en' are valid labelanchors, but only 'ne' is a valid `anchor` parameter. 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", + padx: str | float = 0, + pady: str | float = 0, + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "groove", takefocus: _TakeFocusValue = 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( @@ -3992,26 +3980,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 = ..., + padx: str | float = ..., + pady: str | float = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., takefocus: _TakeFocusValue = ..., 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]: ... @@ -4024,27 +4012,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( @@ -4052,26 +4040,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 c46239df81eb..bebcc1194251 100644 --- a/stdlib/tkinter/ttk.pyi +++ b/stdlib/tkinter/ttk.pyi @@ -38,15 +38,16 @@ def tclobjs_to_py(adict: dict[Any, Any]) -> dict[Any, Any]: ... def setup_master(master=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 +_TtkCompound: TypeAlias = Literal["", "text", "image", "top", "left", "center", "right", "bottom", "none"] class Style: master: Incomplete @@ -79,11 +80,11 @@ 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", @@ -99,11 +100,11 @@ 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 = ..., @@ -124,10 +125,10 @@ 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, @@ -149,10 +150,10 @@ 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=..., @@ -193,7 +194,7 @@ class Entry(Widget, tkinter.Entry): validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = "none", validatecommand: tkinter._EntryValidateCommand = "", width: int = 20, - xscrollcommand: tkinter._XYScrollCommand = "", + xscrollcommand: str | Callable[[float, float], object] = "", ) -> None: ... @overload # type: ignore[override] def configure( @@ -215,7 +216,7 @@ class Entry(Widget, tkinter.Entry): validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ..., validatecommand: tkinter._EntryValidateCommand = ..., 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]: ... @@ -240,7 +241,7 @@ class Entry(Widget, tkinter.Entry): validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ..., validatecommand: tkinter._EntryValidateCommand = ..., 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]: ... @@ -273,7 +274,7 @@ class Combobox(Entry): validatecommand: tkinter._EntryValidateCommand = ..., # 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( @@ -298,7 +299,7 @@ class Combobox(Entry): validatecommand: tkinter._EntryValidateCommand = ..., 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]: ... @@ -326,7 +327,7 @@ class Combobox(Entry): validatecommand: tkinter._EntryValidateCommand = ..., 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]: ... @@ -340,32 +341,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, + 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 = ..., + width: str | float = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -376,20 +377,20 @@ 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 = "", @@ -397,25 +398,25 @@ class Label(Widget): 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 = ..., @@ -423,7 +424,7 @@ class Label(Widget): 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]: ... @@ -434,40 +435,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 = "", 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 = ..., 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]: ... @@ -484,7 +485,7 @@ 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 @@ -504,7 +505,7 @@ 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 = ..., @@ -559,7 +560,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] @@ -629,7 +630,7 @@ 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 = ..., @@ -646,7 +647,7 @@ 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"] = ..., @@ -669,10 +670,10 @@ 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", @@ -690,10 +691,10 @@ 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 = ..., @@ -720,7 +721,7 @@ 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 @@ -738,7 +739,7 @@ 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 = ..., @@ -758,7 +759,7 @@ 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 = ..., @@ -892,7 +893,7 @@ class Spinbox(Entry): 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( @@ -921,7 +922,7 @@ class Spinbox(Entry): 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]: ... @@ -948,7 +949,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 @@ -957,7 +958,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): @@ -980,8 +981,8 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): show: Literal["tree", "headings", "tree headings", ""] | list[str] | tuple[str, ...] = ("tree", "headings"), style: str = "", takefocus: tkinter._TakeFocusValue = ..., - xscrollcommand: tkinter._XYScrollCommand = "", - yscrollcommand: tkinter._XYScrollCommand = "", + xscrollcommand: str | Callable[[float, float], object] = "", + yscrollcommand: str | Callable[[float, float], object] = "", ) -> None: ... @overload def configure( @@ -997,8 +998,8 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): show: Literal["tree", "headings", "tree headings", ""] | list[str] | tuple[str, ...] = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., - xscrollcommand: tkinter._XYScrollCommand = ..., - yscrollcommand: tkinter._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]: ... @@ -1025,7 +1026,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: ... @@ -1054,8 +1055,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: @@ -1073,7 +1074,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, ...] = ..., @@ -1099,7 +1100,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, ...] = ..., @@ -1159,7 +1160,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, ...]: ... @@ -1178,18 +1179,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, + 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..5b7b5a71f8b8 100644 --- a/stubs/ttkthemes/ttkthemes/themed_tk.pyi +++ b/stubs/ttkthemes/ttkthemes/themed_tk.pyi @@ -1,5 +1,5 @@ import tkinter -from typing import Any +from typing import Any, Literal from ._widget import ThemedWidget @@ -31,21 +31,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 = ..., + padx: str | float = ..., + pady: str | float = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., takefocus: tkinter._TakeFocusValue = ..., - width: tkinter._ScreenUnits = ..., + 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 +56,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 = ..., + padx: str | float = ..., + pady: str | float = ..., + relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., takefocus: tkinter._TakeFocusValue = ..., - width: tkinter._ScreenUnits = ..., + 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 676f0c2b1eee77a6560bbf99d0992868e88be39c Mon Sep 17 00:00:00 2001 From: donBarbos Date: Wed, 27 Aug 2025 09:53:29 +0400 Subject: [PATCH 4/5] Revert "get rid of few aliases" This reverts commit 63b21711cbc0a8de86aefb70b431221fdbfaebb8. --- stdlib/tkinter/__init__.pyi | 1242 ++++++++++++----------- stdlib/tkinter/ttk.pyi | 169 ++- stubs/ttkthemes/ttkthemes/themed_tk.pyi | 38 +- 3 files changed, 730 insertions(+), 719 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 38784a94d348..9fd5ed682d65 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -175,10 +175,19 @@ EXCEPTION: Final = _tkinter.EXCEPTION # 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 +_JustifyValue: TypeAlias = Literal["left", "center", "right"] # manual page: Tk_GetJustify +_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): @@ -367,8 +376,8 @@ _Ts = TypeVarTuple("_Ts") @type_check_only class _GridIndexInfo(TypedDict, total=False): - minsize: str | float - pad: str | float + minsize: _ScreenUnits + pad: _ScreenUnits uniform: str | None weight: int @@ -467,7 +476,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: _ScreenUnits) -> float: ... def winfo_geometry(self) -> str: ... def winfo_height(self) -> int: ... def winfo_id(self) -> int: ... @@ -477,7 +486,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: _ScreenUnits) -> int: ... def winfo_pointerx(self) -> int: ... def winfo_pointerxy(self) -> tuple[int, int]: ... def winfo_pointery(self) -> int: ... @@ -568,7 +577,7 @@ class Misc: @overload def pack_propagate(self) -> None: ... propagate = pack_propagate - def grid_anchor(self, anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] | None = None) -> None: ... + def grid_anchor(self, anchor: _Anchor | None = None) -> None: ... anchor = grid_anchor @overload def grid_bbox( @@ -584,8 +593,8 @@ class Misc: index: int | str | list[int] | tuple[int, ...], cnf: _GridIndexInfo = {}, *, - minsize: str | float = ..., - pad: str | float = ..., + minsize: _ScreenUnits = ..., + pad: _ScreenUnits = ..., uniform: str = ..., weight: int = ..., ) -> _GridIndexInfo | MaybeNone: ... # can be None but annoying to check @@ -594,14 +603,14 @@ class Misc: index: int | str | list[int] | tuple[int, ...], cnf: _GridIndexInfo = {}, *, - minsize: str | float = ..., - pad: str | float = ..., + 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: str | float, y: str | float) -> tuple[int, int]: ... + def grid_location(self, x: _ScreenUnits, y: _ScreenUnits) -> tuple[int, int]: ... @overload def grid_propagate(self, flag: bool) -> None: ... @overload @@ -620,32 +629,32 @@ class Misc: sequence: str, *, above: Misc | int = ..., - borderwidth: str | float = ..., + borderwidth: _ScreenUnits = ..., button: int = ..., count: int = ..., data: Any = ..., # anything with usable str() value delta: int = ..., detail: str = ..., focus: bool = ..., - height: str | float = ..., + height: _ScreenUnits = ..., keycode: int = ..., keysym: str = ..., mode: str = ..., override: bool = ..., place: Literal["PlaceOnTop", "PlaceOnBottom"] = ..., root: Misc | int = ..., - rootx: str | float = ..., - rooty: str | float = ..., + rootx: _ScreenUnits = ..., + rooty: _ScreenUnits = ..., sendevent: bool = ..., serial: int = ..., state: int | str = ..., subwindow: Misc | int = ..., time: int = ..., warp: bool = ..., - width: str | float = ..., + width: _ScreenUnits = ..., when: Literal["now", "tail", "head", "mark"] = ..., - x: str | float = ..., - y: str | float = ..., + x: _ScreenUnits = ..., + y: _ScreenUnits = ..., ) -> None: ... def event_info(self, virtual: str | None = None) -> tuple[str, ...]: ... def image_names(self) -> tuple[str, ...]: ... @@ -674,7 +683,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: _ScreenUnits, what: Literal["pixels"]) -> None: ... class YView: @overload @@ -685,7 +694,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: _ScreenUnits, what: Literal["pixels"]) -> None: ... if sys.platform == "darwin": @type_check_only @@ -981,21 +990,21 @@ class Tk(Misc, Wm): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = ..., - height: str | float = ..., + height: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: _ScreenUnits = ..., menu: Menu = ..., - padx: str | float = ..., - pady: str | float = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., + relief: _Relief = ..., takefocus: _TakeFocusValue = ..., - width: str | float = ..., + width: _ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -1044,11 +1053,11 @@ _InMiscNonTotal = TypedDict("_InMiscNonTotal", {"in": Misc}, total=False) @type_check_only class _PackInfo(_InMiscTotal): # 'before' and 'after' never appear in _PackInfo - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] + anchor: _Anchor 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 str or float + # Paddings come out as int or tuple of int, even though any _ScreenUnits # can be specified in pack(). ipadx: int ipady: int @@ -1056,8 +1065,8 @@ class _PackInfo(_InMiscTotal): pady: int | tuple[int, int] class Pack: - # _PackInfo is not the valid type for cnf because pad stuff accepts str or - # float instead of int only. I didn't bother to create another + # _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 # TypedDict for cnf because it appears to be a legacy thing that was # replaced by **kwargs. def pack_configure( @@ -1065,15 +1074,15 @@ class Pack: cnf: Mapping[str, Any] | None = {}, *, after: Misc = ..., - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., + anchor: _Anchor = ..., before: Misc = ..., 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: _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: ... @@ -1085,7 +1094,7 @@ class Pack: @type_check_only class _PlaceInfo(_InMiscNonTotal): # empty dict if widget hasn't been placed - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] + anchor: _Anchor 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 @@ -1101,12 +1110,12 @@ class Place: self, cnf: Mapping[str, Any] | None = {}, *, - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., + anchor: _Anchor = ..., bordermode: Literal["inside", "outside", "ignore"] = ..., - width: str | float = ..., - height: str | float = ..., - x: str | float = ..., - y: str | float = ..., + width: _ScreenUnits = ..., + height: _ScreenUnits = ..., + x: _ScreenUnits = ..., + y: _ScreenUnits = ..., # str allowed for compatibility with place_info() relheight: str | float = ..., relwidth: str | float = ..., @@ -1141,10 +1150,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: _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 @@ -1189,28 +1198,28 @@ class Toplevel(BaseWidget, Wm): cnf: dict[str, Any] | None = {}, *, background: str = ..., - bd: str | float = 0, + bd: _ScreenUnits = 0, bg: str = ..., - border: str | float = 0, - borderwidth: str | float = 0, + border: _ScreenUnits = 0, + borderwidth: _ScreenUnits = 0, class_: str = "Toplevel", colormap: Literal["new", ""] | Misc = "", container: bool = False, cursor: _Cursor = "", - height: str | float = 0, + height: _ScreenUnits = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = 0, + highlightthickness: _ScreenUnits = 0, menu: Menu = ..., name: str = ..., - padx: str | float = 0, - pady: str | float = 0, - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", + padx: _ScreenUnits = 0, + pady: _ScreenUnits = 0, + relief: _Relief = "flat", screen: str = "", # can't be changed after creating widget takefocus: _TakeFocusValue = 0, use: int = ..., visual: str | tuple[str, int] = "", - width: str | float = 0, + width: _ScreenUnits = 0, ) -> None: ... @overload def configure( @@ -1218,21 +1227,21 @@ class Toplevel(BaseWidget, Wm): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = ..., - height: str | float = ..., + height: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: _ScreenUnits = ..., menu: Menu = ..., - padx: str | float = ..., - pady: str | float = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., + relief: _Relief = ..., takefocus: _TakeFocusValue = ..., - width: str | float = ..., + width: _ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -1246,15 +1255,15 @@ class Button(Widget): *, activebackground: str = ..., activeforeground: str = ..., - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = "center", + anchor: _Anchor = "center", background: str = ..., - bd: str | float = ..., # same as borderwidth + bd: _ScreenUnits = ..., # same as borderwidth bg: str = ..., # same as background bitmap: str = "", - border: str | float = ..., # same as borderwidth - borderwidth: str | float = ..., - command: str | Callable[[], Any] = "", - compound: Literal["top", "left", "center", "right", "bottom", "none"] = "none", + border: _ScreenUnits = ..., # same as borderwidth + borderwidth: _ScreenUnits = ..., + command: _ButtonCommand = "", + compound: _Compound = "none", cursor: _Cursor = "", default: Literal["normal", "active", "disabled"] = "disabled", disabledforeground: str = ..., @@ -1262,18 +1271,18 @@ class Button(Widget): font: _FontDescription = "TkDefaultFont", foreground: str = ..., # width and height must be int for buttons containing just text, but - # ints are also valid str | float - height: str | float = 0, + # ints are also valid _ScreenUnits + height: _ScreenUnits = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = 1, - image: _Image | str = "", - justify: Literal["left", "center", "right"] = "center", + highlightthickness: _ScreenUnits = 1, + image: _ImageSpec = "", + justify: _JustifyValue = "center", name: str = ..., - overrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove", ""] = "", - padx: str | float = ..., - pady: str | float = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + overrelief: _Relief | Literal[""] = "", + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., + relief: _Relief = ..., repeatdelay: int = ..., repeatinterval: int = ..., state: Literal["normal", "active", "disabled"] = "normal", @@ -1284,8 +1293,8 @@ class Button(Widget): # of an IntVar. textvariable: Variable = ..., underline: int = -1, - width: str | float = 0, - wraplength: str | float = 0, + width: _ScreenUnits = 0, + wraplength: _ScreenUnits = 0, ) -> None: ... @overload def configure( @@ -1294,31 +1303,31 @@ class Button(Widget): *, activebackground: str = ..., activeforeground: str = ..., - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., + anchor: _Anchor = ..., background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., bitmap: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., - command: str | Callable[[], Any] = ..., - compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., + command: _ButtonCommand = ..., + compound: _Compound = ..., cursor: _Cursor = ..., default: Literal["normal", "active", "disabled"] = ..., disabledforeground: str = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: str | float = ..., + height: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., - image: _Image | str = ..., - justify: Literal["left", "center", "right"] = ..., - overrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove", ""] = ..., - padx: str | float = ..., - pady: str | float = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + highlightthickness: _ScreenUnits = ..., + image: _ImageSpec = ..., + justify: _JustifyValue = ..., + overrelief: _Relief | Literal[""] = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., + relief: _Relief = ..., repeatdelay: int = ..., repeatinterval: int = ..., state: Literal["normal", "active", "disabled"] = ..., @@ -1326,8 +1335,8 @@ class Button(Widget): text: float | str = ..., textvariable: Variable = ..., underline: int = ..., - width: str | float = ..., - wraplength: str | float = ..., + 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]: ... @@ -1342,41 +1351,41 @@ class Canvas(Widget, XView, YView): cnf: dict[str, Any] | None = {}, *, background: str = ..., - bd: str | float = 0, + bd: _ScreenUnits = 0, bg: str = ..., - border: str | float = 0, - borderwidth: str | float = 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 | float. - height: str | float = ..., + # part of it describes _ScreenUnits. + height: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: _ScreenUnits = ..., insertbackground: str = ..., - insertborderwidth: str | float = 0, + insertborderwidth: _ScreenUnits = 0, insertofftime: int = 300, insertontime: int = 600, - insertwidth: str | float = 2, + insertwidth: _ScreenUnits = 2, name: str = ..., offset=..., # undocumented - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", + relief: _Relief = "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[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits] | tuple[()] = (), selectbackground: str = ..., - selectborderwidth: str | float = 1, + selectborderwidth: _ScreenUnits = 1, selectforeground: str = ..., # man page says that state can be 'hidden', but it can't state: Literal["normal", "disabled"] = "normal", takefocus: _TakeFocusValue = "", - width: str | float = ..., - xscrollcommand: str | Callable[[float, float], object] = "", - xscrollincrement: str | float = 0, - yscrollcommand: str | Callable[[float, float], object] = "", - yscrollincrement: str | float = 0, + width: _ScreenUnits = ..., + xscrollcommand: _XYScrollCommand = "", + xscrollincrement: _ScreenUnits = 0, + yscrollcommand: _XYScrollCommand = "", + yscrollincrement: _ScreenUnits = 0, ) -> None: ... @overload def configure( @@ -1384,35 +1393,35 @@ class Canvas(Widget, XView, YView): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., closeenough: float = ..., confine: bool = ..., cursor: _Cursor = ..., - height: str | float = ..., + height: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: _ScreenUnits = ..., insertbackground: str = ..., - insertborderwidth: str | float = ..., + insertborderwidth: _ScreenUnits = ..., insertofftime: int = ..., insertontime: int = ..., - insertwidth: str | float = ..., + insertwidth: _ScreenUnits = ..., offset=..., # undocumented - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., - scrollregion: tuple[str | float, str | float, str | float, str | float] | tuple[()] = ..., + relief: _Relief = ..., + scrollregion: tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits] | tuple[()] = ..., selectbackground: str = ..., - selectborderwidth: str | float = ..., + selectborderwidth: _ScreenUnits = ..., selectforeground: str = ..., state: Literal["normal", "disabled"] = ..., takefocus: _TakeFocusValue = ..., - width: str | float = ..., - xscrollcommand: str | Callable[[float, float], object] = ..., - xscrollincrement: str | float = ..., - yscrollcommand: str | Callable[[float, float], object] = ..., - yscrollincrement: str | float = ..., + width: _ScreenUnits = ..., + xscrollcommand: _XYScrollCommand = ..., + xscrollincrement: _ScreenUnits = ..., + yscrollcommand: _XYScrollCommand = ..., + yscrollincrement: _ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -1422,20 +1431,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: _ScreenUnits, y: _ScreenUnits, halo: _ScreenUnits | 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: _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: str | float, y: str | float, halo: str | float | 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: 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: _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] @@ -1480,25 +1489,25 @@ class Canvas(Widget, XView, YView): activedash: str | int | list[int] | tuple[int, ...] = ..., activefill: str = ..., activestipple: str = ..., - activewidth: str | float = ..., + 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: str | float = ..., + dashoffset: _ScreenUnits = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledstipple: str = ..., - disabledwidth: str | float = ..., + disabledwidth: _ScreenUnits = ..., fill: str = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: str | float = ..., + offset: _ScreenUnits = ..., smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_line( @@ -1510,25 +1519,25 @@ class Canvas(Widget, XView, YView): activedash: str | int | list[int] | tuple[int, ...] = ..., activefill: str = ..., activestipple: str = ..., - activewidth: str | float = ..., + 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: str | float = ..., + dashoffset: _ScreenUnits = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledstipple: str = ..., - disabledwidth: str | float = ..., + disabledwidth: _ScreenUnits = ..., fill: str = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: str | float = ..., + offset: _ScreenUnits = ..., smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_line( @@ -1546,25 +1555,25 @@ class Canvas(Widget, XView, YView): activedash: str | int | list[int] | tuple[int, ...] = ..., activefill: str = ..., activestipple: str = ..., - activewidth: str | float = ..., + 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: str | float = ..., + dashoffset: _ScreenUnits = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledstipple: str = ..., - disabledwidth: str | float = ..., + disabledwidth: _ScreenUnits = ..., fill: str = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: str | float = ..., + offset: _ScreenUnits = ..., smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_oval( @@ -1580,24 +1589,24 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: str | float = ..., + activewidth: _ScreenUnits = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: str | float = ..., + dashoffset: _ScreenUnits = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: str | float = ..., + disabledwidth: _ScreenUnits = ..., fill: str = ..., - offset: str | float = ..., + offset: _ScreenUnits = ..., outline: str = ..., - outlineoffset: str | float = ..., + outlineoffset: _ScreenUnits = ..., outlinestipple: str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_oval( @@ -1611,24 +1620,24 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: str | float = ..., + activewidth: _ScreenUnits = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: str | float = ..., + dashoffset: _ScreenUnits = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: str | float = ..., + disabledwidth: _ScreenUnits = ..., fill: str = ..., - offset: str | float = ..., + offset: _ScreenUnits = ..., outline: str = ..., - outlineoffset: str | float = ..., + outlineoffset: _ScreenUnits = ..., outlinestipple: str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_oval( @@ -1648,24 +1657,24 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: str | float = ..., + activewidth: _ScreenUnits = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: str | float = ..., + dashoffset: _ScreenUnits = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: str | float = ..., + disabledwidth: _ScreenUnits = ..., fill: str = ..., - offset: str | float = ..., + offset: _ScreenUnits = ..., outline: str = ..., - outlineoffset: str | float = ..., + outlineoffset: _ScreenUnits = ..., outlinestipple: str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_polygon( @@ -1681,27 +1690,27 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: str | float = ..., + activewidth: _ScreenUnits = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: str | float = ..., + dashoffset: _ScreenUnits = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: str | float = ..., + disabledwidth: _ScreenUnits = ..., fill: str = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: str | float = ..., + offset: _ScreenUnits = ..., outline: str = ..., - outlineoffset: str | float = ..., + outlineoffset: _ScreenUnits = ..., outlinestipple: str = ..., smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_polygon( @@ -1715,27 +1724,27 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: str | float = ..., + activewidth: _ScreenUnits = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: str | float = ..., + dashoffset: _ScreenUnits = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: str | float = ..., + disabledwidth: _ScreenUnits = ..., fill: str = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: str | float = ..., + offset: _ScreenUnits = ..., outline: str = ..., - outlineoffset: str | float = ..., + outlineoffset: _ScreenUnits = ..., outlinestipple: str = ..., smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_polygon( @@ -1755,27 +1764,27 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: str | float = ..., + activewidth: _ScreenUnits = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: str | float = ..., + dashoffset: _ScreenUnits = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: str | float = ..., + disabledwidth: _ScreenUnits = ..., fill: str = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: str | float = ..., + offset: _ScreenUnits = ..., outline: str = ..., - outlineoffset: str | float = ..., + outlineoffset: _ScreenUnits = ..., outlinestipple: str = ..., smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_rectangle( @@ -1791,24 +1800,24 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: str | float = ..., + activewidth: _ScreenUnits = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: str | float = ..., + dashoffset: _ScreenUnits = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: str | float = ..., + disabledwidth: _ScreenUnits = ..., fill: str = ..., - offset: str | float = ..., + offset: _ScreenUnits = ..., outline: str = ..., - outlineoffset: str | float = ..., + outlineoffset: _ScreenUnits = ..., outlinestipple: str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_rectangle( @@ -1822,24 +1831,24 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: str | float = ..., + activewidth: _ScreenUnits = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: str | float = ..., + dashoffset: _ScreenUnits = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: str | float = ..., + disabledwidth: _ScreenUnits = ..., fill: str = ..., - offset: str | float = ..., + offset: _ScreenUnits = ..., outline: str = ..., - outlineoffset: str | float = ..., + outlineoffset: _ScreenUnits = ..., outlinestipple: str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_rectangle( @@ -1859,24 +1868,24 @@ class Canvas(Widget, XView, YView): activeoutline: str = ..., activeoutlinestipple: str = ..., activestipple: str = ..., - activewidth: str | float = ..., + activewidth: _ScreenUnits = ..., dash: str | int | list[int] | tuple[int, ...] = ..., - dashoffset: str | float = ..., + dashoffset: _ScreenUnits = ..., disableddash: str | int | list[int] | tuple[int, ...] = ..., disabledfill: str = ..., disabledoutline: str = ..., disabledoutlinestipple: str = ..., disabledstipple: str = ..., - disabledwidth: str | float = ..., + disabledwidth: _ScreenUnits = ..., fill: str = ..., - offset: str | float = ..., + offset: _ScreenUnits = ..., outline: str = ..., - outlineoffset: str | float = ..., + outlineoffset: _ScreenUnits = ..., outlinestipple: str = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_text( @@ -1887,19 +1896,19 @@ class Canvas(Widget, XView, YView): *, activefill: str = ..., activestipple: str = ..., - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., + anchor: _Anchor = ..., angle: float | str = ..., disabledfill: str = ..., disabledstipple: str = ..., fill: str = ..., font: _FontDescription = ..., - justify: Literal["left", "center", "right"] = ..., - offset: str | float = ..., + justify: _JustifyValue = ..., + offset: _ScreenUnits = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., text: float | str = ..., - width: str | float = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_text( @@ -1909,19 +1918,19 @@ class Canvas(Widget, XView, YView): *, activefill: str = ..., activestipple: str = ..., - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., + anchor: _Anchor = ..., angle: float | str = ..., disabledfill: str = ..., disabledstipple: str = ..., fill: str = ..., font: _FontDescription = ..., - justify: Literal["left", "center", "right"] = ..., - offset: str | float = ..., + justify: _JustifyValue = ..., + offset: _ScreenUnits = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., tags: str | list[str] | tuple[str, ...] = ..., text: float | str = ..., - width: str | float = ..., + width: _ScreenUnits = ..., ) -> int: ... @overload def create_window( @@ -1930,11 +1939,11 @@ class Canvas(Widget, XView, YView): y: float, /, *, - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., - height: str | float = ..., + anchor: _Anchor = ..., + height: _ScreenUnits = ..., state: Literal["normal", "hidden", "disabled"] = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: _ScreenUnits = ..., window: Widget = ..., ) -> int: ... @overload @@ -1943,11 +1952,11 @@ class Canvas(Widget, XView, YView): coords: tuple[float, float] | list[int] | list[float], /, *, - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., - height: str | float = ..., + anchor: _Anchor = ..., + height: _ScreenUnits = ..., state: Literal["normal", "hidden", "disabled"] = ..., tags: str | list[str] | tuple[str, ...] = ..., - width: str | float = ..., + width: _ScreenUnits = ..., window: Widget = ..., ) -> int: ... def dchars(self, *args) -> None: ... @@ -1980,7 +1989,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: str | float, yOrigin: str | float, 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: ... @@ -1998,29 +2009,29 @@ class Checkbutton(Widget): *, activebackground: str = ..., activeforeground: str = ..., - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = "center", + anchor: _Anchor = "center", background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., bitmap: str = "", - border: str | float = ..., - borderwidth: str | float = ..., - command: str | Callable[[], Any] = "", - compound: Literal["top", "left", "center", "right", "bottom", "none"] = "none", + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., + command: _ButtonCommand = "", + compound: _Compound = "none", cursor: _Cursor = "", disabledforeground: str = ..., fg: str = ..., font: _FontDescription = "TkDefaultFont", foreground: str = ..., - height: str | float = 0, + height: _ScreenUnits = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = 1, - image: _Image | str = "", + highlightthickness: _ScreenUnits = 1, + image: _ImageSpec = "", indicatoron: bool = True, - justify: Literal["left", "center", "right"] = "center", + justify: _JustifyValue = "center", name: str = ..., - offrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + offrelief: _Relief = ..., # 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. @@ -2033,22 +2044,22 @@ class Checkbutton(Widget): # done by setting variable to empty string (the default). offvalue: Any = 0, onvalue: Any = 1, - 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", + overrelief: _Relief | Literal[""] = "", + padx: _ScreenUnits = 1, + pady: _ScreenUnits = 1, + relief: _Relief = "flat", selectcolor: str = ..., - selectimage: _Image | str = "", + selectimage: _ImageSpec = "", state: Literal["normal", "active", "disabled"] = "normal", takefocus: _TakeFocusValue = "", text: float | str = "", textvariable: Variable = ..., - tristateimage: _Image | str = "", + tristateimage: _ImageSpec = "", tristatevalue: Any = "", underline: int = -1, variable: Variable | Literal[""] = ..., - width: str | float = 0, - wraplength: str | float = 0, + width: _ScreenUnits = 0, + wraplength: _ScreenUnits = 0, ) -> None: ... @overload def configure( @@ -2057,46 +2068,46 @@ class Checkbutton(Widget): *, activebackground: str = ..., activeforeground: str = ..., - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., + anchor: _Anchor = ..., background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., bitmap: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., - command: str | Callable[[], Any] = ..., - compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., + command: _ButtonCommand = ..., + compound: _Compound = ..., cursor: _Cursor = ..., disabledforeground: str = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: str | float = ..., + height: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., - image: _Image | str = ..., + highlightthickness: _ScreenUnits = ..., + image: _ImageSpec = ..., indicatoron: bool = ..., - justify: Literal["left", "center", "right"] = ..., - offrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + justify: _JustifyValue = ..., + offrelief: _Relief = ..., offvalue: Any = ..., onvalue: Any = ..., - overrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove", ""] = ..., - padx: str | float = ..., - pady: str | float = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + overrelief: _Relief | Literal[""] = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., + relief: _Relief = ..., selectcolor: str = ..., - selectimage: _Image | str = ..., + selectimage: _ImageSpec = ..., state: Literal["normal", "active", "disabled"] = ..., takefocus: _TakeFocusValue = ..., text: float | str = ..., textvariable: Variable = ..., - tristateimage: _Image | str = ..., + tristateimage: _ImageSpec = ..., tristatevalue: Any = ..., underline: int = ..., variable: Variable | Literal[""] = ..., - width: str | float = ..., - wraplength: str | float = ..., + 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]: ... @@ -2114,10 +2125,10 @@ class Entry(Widget, XView): cnf: dict[str, Any] | None = {}, *, background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = "xterm", disabledbackground: str = ..., disabledforeground: str = ..., @@ -2127,20 +2138,20 @@ class Entry(Widget, XView): foreground: str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: _ScreenUnits = ..., insertbackground: str = ..., - insertborderwidth: str | float = 0, + insertborderwidth: _ScreenUnits = 0, insertofftime: int = 300, insertontime: int = 600, - insertwidth: str | float = ..., + insertwidth: _ScreenUnits = ..., invalidcommand: _EntryValidateCommand = "", invcmd: _EntryValidateCommand = "", # same as invalidcommand - justify: Literal["left", "center", "right"] = "left", + justify: _JustifyValue = "left", name: str = ..., readonlybackground: str = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "sunken", + relief: _Relief = "sunken", selectbackground: str = ..., - selectborderwidth: str | float = ..., + selectborderwidth: _ScreenUnits = ..., selectforeground: str = ..., show: str = "", state: Literal["normal", "disabled", "readonly"] = "normal", @@ -2150,7 +2161,7 @@ class Entry(Widget, XView): validatecommand: _EntryValidateCommand = "", vcmd: _EntryValidateCommand = "", # same as validatecommand width: int = 20, - xscrollcommand: str | Callable[[float, float], object] = "", + xscrollcommand: _XYScrollCommand = "", ) -> None: ... @overload def configure( @@ -2158,10 +2169,10 @@ class Entry(Widget, XView): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = ..., disabledbackground: str = ..., disabledforeground: str = ..., @@ -2171,19 +2182,19 @@ class Entry(Widget, XView): foreground: str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: _ScreenUnits = ..., insertbackground: str = ..., - insertborderwidth: str | float = ..., + insertborderwidth: _ScreenUnits = ..., insertofftime: int = ..., insertontime: int = ..., - insertwidth: str | float = ..., + insertwidth: _ScreenUnits = ..., invalidcommand: _EntryValidateCommand = ..., invcmd: _EntryValidateCommand = ..., - justify: Literal["left", "center", "right"] = ..., + justify: _JustifyValue = ..., readonlybackground: str = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + relief: _Relief = ..., selectbackground: str = ..., - selectborderwidth: str | float = ..., + selectborderwidth: _ScreenUnits = ..., selectforeground: str = ..., show: str = ..., state: Literal["normal", "disabled", "readonly"] = ..., @@ -2193,7 +2204,7 @@ class Entry(Widget, XView): validatecommand: _EntryValidateCommand = ..., vcmd: _EntryValidateCommand = ..., width: int = ..., - xscrollcommand: str | Callable[[float, float], object] = ..., + xscrollcommand: _XYScrollCommand = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -2225,25 +2236,25 @@ class Frame(Widget): cnf: dict[str, Any] | None = {}, *, background: str = ..., - bd: str | float = 0, + bd: _ScreenUnits = 0, bg: str = ..., - border: str | float = 0, - borderwidth: str | float = 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: str | float = 0, + height: _ScreenUnits = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = 0, + highlightthickness: _ScreenUnits = 0, name: str = ..., - padx: str | float = 0, - pady: str | float = 0, - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", + padx: _ScreenUnits = 0, + pady: _ScreenUnits = 0, + relief: _Relief = "flat", takefocus: _TakeFocusValue = 0, visual: str | tuple[str, int] = "", # can't be changed with configure() - width: str | float = 0, + width: _ScreenUnits = 0, ) -> None: ... @overload def configure( @@ -2251,20 +2262,20 @@ class Frame(Widget): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = ..., - height: str | float = ..., + height: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., - padx: str | float = ..., - pady: str | float = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + highlightthickness: _ScreenUnits = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., + relief: _Relief = ..., takefocus: _TakeFocusValue = ..., - width: str | float = ..., + width: _ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -2278,36 +2289,36 @@ class Label(Widget): *, activebackground: str = ..., activeforeground: str = ..., - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = "center", + anchor: _Anchor = "center", background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., bitmap: str = "", - border: str | float = ..., - borderwidth: str | float = ..., - compound: Literal["top", "left", "center", "right", "bottom", "none"] = "none", + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., + compound: _Compound = "none", cursor: _Cursor = "", disabledforeground: str = ..., fg: str = ..., font: _FontDescription = "TkDefaultFont", foreground: str = ..., - height: str | float = 0, + height: _ScreenUnits = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = 0, - image: _Image | str = "", - justify: Literal["left", "center", "right"] = "center", + highlightthickness: _ScreenUnits = 0, + image: _ImageSpec = "", + justify: _JustifyValue = "center", name: str = ..., - padx: str | float = 1, - pady: str | float = 1, - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", + padx: _ScreenUnits = 1, + pady: _ScreenUnits = 1, + relief: _Relief = "flat", state: Literal["normal", "active", "disabled"] = "normal", takefocus: _TakeFocusValue = 0, text: float | str = "", textvariable: Variable = ..., underline: int = -1, - width: str | float = 0, - wraplength: str | float = 0, + width: _ScreenUnits = 0, + wraplength: _ScreenUnits = 0, ) -> None: ... @overload def configure( @@ -2316,35 +2327,35 @@ class Label(Widget): *, activebackground: str = ..., activeforeground: str = ..., - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., + anchor: _Anchor = ..., background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., bitmap: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., - compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., + compound: _Compound = ..., cursor: _Cursor = ..., disabledforeground: str = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: str | float = ..., + height: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., - image: _Image | str = ..., - justify: Literal["left", "center", "right"] = ..., - padx: str | float = ..., - pady: str | float = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + highlightthickness: _ScreenUnits = ..., + image: _ImageSpec = ..., + justify: _JustifyValue = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., + relief: _Relief = ..., state: Literal["normal", "active", "disabled"] = ..., takefocus: _TakeFocusValue = ..., text: float | str = ..., textvariable: Variable = ..., underline: int = ..., - width: str | float = ..., - wraplength: str | float = ..., + 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]: ... @@ -2358,10 +2369,10 @@ class Listbox(Widget, XView, YView): *, activestyle: Literal["dotbox", "none", "underline"] = ..., background: str = ..., - bd: str | float = 1, + bd: _ScreenUnits = 1, bg: str = ..., - border: str | float = 1, - borderwidth: str | float = 1, + border: _ScreenUnits = 1, + borderwidth: _ScreenUnits = 1, cursor: _Cursor = "", disabledforeground: str = ..., exportselection: bool | Literal[0, 1] = 1, @@ -2371,8 +2382,8 @@ class Listbox(Widget, XView, YView): height: int = 10, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., - justify: Literal["left", "center", "right"] = "left", + highlightthickness: _ScreenUnits = ..., + justify: _JustifyValue = "left", # There's no tkinter.ListVar, but seems like bare tkinter.Variable # actually works for this: # @@ -2384,9 +2395,9 @@ class Listbox(Widget, XView, YView): # ('foo', 'bar', 'baz') listvariable: Variable = ..., name: str = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + relief: _Relief = ..., selectbackground: str = ..., - selectborderwidth: str | float = 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, @@ -2399,8 +2410,8 @@ class Listbox(Widget, XView, YView): state: Literal["normal", "disabled"] = "normal", takefocus: _TakeFocusValue = "", width: int = 20, - xscrollcommand: str | Callable[[float, float], object] = "", - yscrollcommand: str | Callable[[float, float], object] = "", + xscrollcommand: _XYScrollCommand = "", + yscrollcommand: _XYScrollCommand = "", ) -> None: ... @overload def configure( @@ -2409,10 +2420,10 @@ class Listbox(Widget, XView, YView): *, activestyle: Literal["dotbox", "none", "underline"] = ..., background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = ..., disabledforeground: str = ..., exportselection: bool = ..., @@ -2422,20 +2433,20 @@ class Listbox(Widget, XView, YView): height: int = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., - justify: Literal["left", "center", "right"] = ..., + highlightthickness: _ScreenUnits = ..., + justify: _JustifyValue = ..., listvariable: Variable = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + relief: _Relief = ..., selectbackground: str = ..., - selectborderwidth: str | float = ..., + selectborderwidth: _ScreenUnits = ..., selectforeground: str = ..., selectmode: str | Literal["single", "browse", "multiple", "extended"] = ..., # noqa: Y051 setgrid: bool = ..., state: Literal["normal", "disabled"] = ..., takefocus: _TakeFocusValue = ..., width: int = ..., - xscrollcommand: str | Callable[[float, float], object] = ..., - yscrollcommand: str | Callable[[float, float], object] = ..., + xscrollcommand: _XYScrollCommand = ..., + yscrollcommand: _XYScrollCommand = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -2471,13 +2482,13 @@ class Menu(Widget): cnf: dict[str, Any] | None = {}, *, activebackground: str = ..., - activeborderwidth: str | float = ..., + activeborderwidth: _ScreenUnits = ..., activeforeground: str = ..., background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = "arrow", disabledforeground: str = ..., fg: str = ..., @@ -2485,7 +2496,7 @@ class Menu(Widget): foreground: str = ..., name: str = ..., postcommand: Callable[[], object] | str = "", - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + relief: _Relief = ..., selectcolor: str = ..., takefocus: _TakeFocusValue = 0, tearoff: bool | Literal[0, 1] = 1, @@ -2502,20 +2513,20 @@ class Menu(Widget): cnf: dict[str, Any] | None = None, *, activebackground: str = ..., - activeborderwidth: str | float = ..., + activeborderwidth: _ScreenUnits = ..., activeforeground: str = ..., background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = ..., disabledforeground: str = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., postcommand: Callable[[], object] | str = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + relief: _Relief = ..., selectcolor: str = ..., takefocus: _TakeFocusValue = ..., tearoff: bool = ..., @@ -2541,11 +2552,11 @@ class Menu(Widget): bitmap: str = ..., columnbreak: int = ..., command: Callable[[], object] | str = ..., - compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., + compound: _Compound = ..., font: _FontDescription = ..., foreground: str = ..., hidemargin: bool = ..., - image: _Image | str = ..., + image: _ImageSpec = ..., label: str = ..., menu: Menu = ..., state: Literal["normal", "active", "disabled"] = ..., @@ -2562,17 +2573,17 @@ class Menu(Widget): bitmap: str = ..., columnbreak: int = ..., command: Callable[[], object] | str = ..., - compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., + compound: _Compound = ..., font: _FontDescription = ..., foreground: str = ..., hidemargin: bool = ..., - image: _Image | str = ..., + image: _ImageSpec = ..., indicatoron: bool = ..., label: str = ..., offvalue: Any = ..., onvalue: Any = ..., selectcolor: str = ..., - selectimage: _Image | str = ..., + selectimage: _ImageSpec = ..., state: Literal["normal", "active", "disabled"] = ..., underline: int = ..., variable: Variable = ..., @@ -2588,11 +2599,11 @@ class Menu(Widget): bitmap: str = ..., columnbreak: int = ..., command: Callable[[], object] | str = ..., - compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., + compound: _Compound = ..., font: _FontDescription = ..., foreground: str = ..., hidemargin: bool = ..., - image: _Image | str = ..., + image: _ImageSpec = ..., label: str = ..., state: Literal["normal", "active", "disabled"] = ..., underline: int = ..., @@ -2608,15 +2619,15 @@ class Menu(Widget): bitmap: str = ..., columnbreak: int = ..., command: Callable[[], object] | str = ..., - compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., + compound: _Compound = ..., font: _FontDescription = ..., foreground: str = ..., hidemargin: bool = ..., - image: _Image | str = ..., + image: _ImageSpec = ..., indicatoron: bool = ..., label: str = ..., selectcolor: str = ..., - selectimage: _Image | str = ..., + selectimage: _ImageSpec = ..., state: Literal["normal", "active", "disabled"] = ..., underline: int = ..., value: Any = ..., @@ -2635,11 +2646,11 @@ class Menu(Widget): bitmap: str = ..., columnbreak: int = ..., command: Callable[[], object] | str = ..., - compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., + compound: _Compound = ..., font: _FontDescription = ..., foreground: str = ..., hidemargin: bool = ..., - image: _Image | str = ..., + image: _ImageSpec = ..., label: str = ..., menu: Menu = ..., state: Literal["normal", "active", "disabled"] = ..., @@ -2657,17 +2668,17 @@ class Menu(Widget): bitmap: str = ..., columnbreak: int = ..., command: Callable[[], object] | str = ..., - compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., + compound: _Compound = ..., font: _FontDescription = ..., foreground: str = ..., hidemargin: bool = ..., - image: _Image | str = ..., + image: _ImageSpec = ..., indicatoron: bool = ..., label: str = ..., offvalue: Any = ..., onvalue: Any = ..., selectcolor: str = ..., - selectimage: _Image | str = ..., + selectimage: _ImageSpec = ..., state: Literal["normal", "active", "disabled"] = ..., underline: int = ..., variable: Variable = ..., @@ -2684,11 +2695,11 @@ class Menu(Widget): bitmap: str = ..., columnbreak: int = ..., command: Callable[[], object] | str = ..., - compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., + compound: _Compound = ..., font: _FontDescription = ..., foreground: str = ..., hidemargin: bool = ..., - image: _Image | str = ..., + image: _ImageSpec = ..., label: str = ..., state: Literal["normal", "active", "disabled"] = ..., underline: int = ..., @@ -2705,15 +2716,15 @@ class Menu(Widget): bitmap: str = ..., columnbreak: int = ..., command: Callable[[], object] | str = ..., - compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., + compound: _Compound = ..., font: _FontDescription = ..., foreground: str = ..., hidemargin: bool = ..., - image: _Image | str = ..., + image: _ImageSpec = ..., indicatoron: bool = ..., label: str = ..., selectcolor: str = ..., - selectimage: _Image | str = ..., + selectimage: _ImageSpec = ..., state: Literal["normal", "active", "disabled"] = ..., underline: int = ..., value: Any = ..., @@ -2742,39 +2753,39 @@ class Menubutton(Widget): *, activebackground: str = ..., activeforeground: str = ..., - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., + anchor: _Anchor = ..., background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., bitmap: str = "", - border: str | float = ..., - borderwidth: str | float = ..., - compound: Literal["top", "left", "center", "right", "bottom", "none"] = "none", + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., + compound: _Compound = "none", cursor: _Cursor = "", direction: Literal["above", "below", "left", "right", "flush"] = "below", disabledforeground: str = ..., fg: str = ..., font: _FontDescription = "TkDefaultFont", foreground: str = ..., - height: str | float = 0, + height: _ScreenUnits = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = 0, - image: _Image | str = "", + highlightthickness: _ScreenUnits = 0, + image: _ImageSpec = "", indicatoron: bool = ..., - justify: Literal["left", "center", "right"] = ..., + justify: _JustifyValue = ..., menu: Menu = ..., name: str = ..., - padx: str | float = ..., - pady: str | float = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., + relief: _Relief = "flat", state: Literal["normal", "active", "disabled"] = "normal", takefocus: _TakeFocusValue = 0, text: float | str = "", textvariable: Variable = ..., underline: int = -1, - width: str | float = 0, - wraplength: str | float = 0, + width: _ScreenUnits = 0, + wraplength: _ScreenUnits = 0, ) -> None: ... @overload def configure( @@ -2783,38 +2794,38 @@ class Menubutton(Widget): *, activebackground: str = ..., activeforeground: str = ..., - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., + anchor: _Anchor = ..., background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., bitmap: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., - compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., + compound: _Compound = ..., cursor: _Cursor = ..., direction: Literal["above", "below", "left", "right", "flush"] = ..., disabledforeground: str = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: str | float = ..., + height: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., - image: _Image | str = ..., + highlightthickness: _ScreenUnits = ..., + image: _ImageSpec = ..., indicatoron: bool = ..., - justify: Literal["left", "center", "right"] = ..., + justify: _JustifyValue = ..., menu: Menu = ..., - padx: str | float = ..., - pady: str | float = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., + relief: _Relief = ..., state: Literal["normal", "active", "disabled"] = ..., takefocus: _TakeFocusValue = ..., text: float | str = ..., textvariable: Variable = ..., underline: int = ..., - width: str | float = ..., - wraplength: str | float = ..., + 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]: ... @@ -2826,58 +2837,58 @@ class Message(Widget): master: Misc | None = None, cnf: dict[str, Any] | None = {}, *, - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = "center", + anchor: _Anchor = "center", aspect: int = 150, background: str = ..., - bd: str | float = 1, + bd: _ScreenUnits = 1, bg: str = ..., - border: str | float = 1, - borderwidth: str | float = 1, + border: _ScreenUnits = 1, + borderwidth: _ScreenUnits = 1, cursor: _Cursor = "", fg: str = ..., font: _FontDescription = "TkDefaultFont", foreground: str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = 0, - justify: Literal["left", "center", "right"] = "left", + highlightthickness: _ScreenUnits = 0, + justify: _JustifyValue = "left", name: str = ..., - padx: str | float = ..., - pady: str | float = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., + relief: _Relief = "flat", takefocus: _TakeFocusValue = 0, text: float | str = "", textvariable: Variable = ..., # there's width but no height - width: str | float = 0, + width: _ScreenUnits = 0, ) -> None: ... @overload def configure( self, cnf: dict[str, Any] | None = None, *, - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., + anchor: _Anchor = ..., aspect: int = ..., background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., - justify: Literal["left", "center", "right"] = ..., - padx: str | float = ..., - pady: str | float = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + highlightthickness: _ScreenUnits = ..., + justify: _JustifyValue = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., + relief: _Relief = ..., takefocus: _TakeFocusValue = ..., text: float | str = ..., textvariable: Variable = ..., - width: str | float = ..., + width: _ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -2891,46 +2902,46 @@ class Radiobutton(Widget): *, activebackground: str = ..., activeforeground: str = ..., - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = "center", + anchor: _Anchor = "center", background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., bitmap: str = "", - border: str | float = ..., - borderwidth: str | float = ..., - command: str | Callable[[], Any] = "", - compound: Literal["top", "left", "center", "right", "bottom", "none"] = "none", + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., + command: _ButtonCommand = "", + compound: _Compound = "none", cursor: _Cursor = "", disabledforeground: str = ..., fg: str = ..., font: _FontDescription = "TkDefaultFont", foreground: str = ..., - height: str | float = 0, + height: _ScreenUnits = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = 1, - image: _Image | str = "", + highlightthickness: _ScreenUnits = 1, + image: _ImageSpec = "", indicatoron: bool = True, - justify: Literal["left", "center", "right"] = "center", + justify: _JustifyValue = "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, - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", + offrelief: _Relief = ..., + overrelief: _Relief | Literal[""] = "", + padx: _ScreenUnits = 1, + pady: _ScreenUnits = 1, + relief: _Relief = "flat", selectcolor: str = ..., - selectimage: _Image | str = "", + selectimage: _ImageSpec = "", state: Literal["normal", "active", "disabled"] = "normal", takefocus: _TakeFocusValue = "", text: float | str = "", textvariable: Variable = ..., - tristateimage: _Image | str = "", + tristateimage: _ImageSpec = "", tristatevalue: Any = "", underline: int = -1, value: Any = "", variable: Variable | Literal[""] = ..., - width: str | float = 0, - wraplength: str | float = 0, + width: _ScreenUnits = 0, + wraplength: _ScreenUnits = 0, ) -> None: ... @overload def configure( @@ -2939,45 +2950,45 @@ class Radiobutton(Widget): *, activebackground: str = ..., activeforeground: str = ..., - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., + anchor: _Anchor = ..., background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., bitmap: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., - command: str | Callable[[], Any] = ..., - compound: Literal["top", "left", "center", "right", "bottom", "none"] = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., + command: _ButtonCommand = ..., + compound: _Compound = ..., cursor: _Cursor = ..., disabledforeground: str = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: str | float = ..., + height: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., - image: _Image | str = ..., + highlightthickness: _ScreenUnits = ..., + image: _ImageSpec = ..., 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 = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + justify: _JustifyValue = ..., + offrelief: _Relief = ..., + overrelief: _Relief | Literal[""] = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., + relief: _Relief = ..., selectcolor: str = ..., - selectimage: _Image | str = ..., + selectimage: _ImageSpec = ..., state: Literal["normal", "active", "disabled"] = ..., takefocus: _TakeFocusValue = ..., text: float | str = ..., textvariable: Variable = ..., - tristateimage: _Image | str = ..., + tristateimage: _ImageSpec = ..., tristatevalue: Any = ..., underline: int = ..., value: Any = ..., variable: Variable | Literal[""] = ..., - width: str | float = ..., - wraplength: str | float = ..., + 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]: ... @@ -2995,11 +3006,11 @@ class Scale(Widget): *, activebackground: str = ..., background: str = ..., - bd: str | float = 1, + bd: _ScreenUnits = 1, bg: str = ..., bigincrement: float = 0.0, - border: str | float = 1, - borderwidth: str | float = 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 = "", @@ -3010,25 +3021,25 @@ class Scale(Widget): from_: float = 0.0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: _ScreenUnits = ..., label: str = "", - length: str | float = 100, + length: _ScreenUnits = 100, name: str = ..., orient: Literal["horizontal", "vertical"] = "vertical", - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", + relief: _Relief = "flat", repeatdelay: int = 300, repeatinterval: int = 100, resolution: float = 1.0, showvalue: bool = True, - sliderlength: str | float = 30, - sliderrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "raised", + sliderlength: _ScreenUnits = 30, + sliderrelief: _Relief = "raised", state: Literal["normal", "active", "disabled"] = "normal", takefocus: _TakeFocusValue = "", tickinterval: float = 0.0, to: float = 100.0, troughcolor: str = ..., variable: IntVar | DoubleVar = ..., - width: str | float = 15, + width: _ScreenUnits = 15, ) -> None: ... @overload def configure( @@ -3037,11 +3048,11 @@ class Scale(Widget): *, activebackground: str = ..., background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., bigincrement: float = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., command: str | Callable[[str], object] = ..., cursor: _Cursor = ..., digits: int = ..., @@ -3051,24 +3062,24 @@ class Scale(Widget): from_: float = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: _ScreenUnits = ..., label: str = ..., - length: str | float = ..., + length: _ScreenUnits = ..., orient: Literal["horizontal", "vertical"] = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + relief: _Relief = ..., repeatdelay: int = ..., repeatinterval: int = ..., resolution: float = ..., showvalue: bool = ..., - sliderlength: str | float = ..., - sliderrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + sliderlength: _ScreenUnits = ..., + sliderrelief: _Relief = ..., state: Literal["normal", "active", "disabled"] = ..., takefocus: _TakeFocusValue = ..., tickinterval: float = ..., to: float = ..., troughcolor: str = ..., variable: IntVar | DoubleVar = ..., - width: str | float = ..., + width: _ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -3085,31 +3096,31 @@ class Scrollbar(Widget): cnf: dict[str, Any] | None = {}, *, activebackground: str = ..., - activerelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "raised", + activerelief: _Relief = "raised", background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + 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: str | float = -1, + elementborderwidth: _ScreenUnits = -1, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = 0, + highlightthickness: _ScreenUnits = 0, jump: bool = False, name: str = ..., orient: Literal["horizontal", "vertical"] = "vertical", - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + relief: _Relief = ..., repeatdelay: int = 300, repeatinterval: int = 100, takefocus: _TakeFocusValue = "", troughcolor: str = ..., - width: str | float = ..., + width: _ScreenUnits = ..., ) -> None: ... @overload def configure( @@ -3117,26 +3128,26 @@ class Scrollbar(Widget): cnf: dict[str, Any] | None = None, *, activebackground: str = ..., - activerelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + activerelief: _Relief = ..., background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., command: Callable[..., tuple[float, float] | None] | str = ..., cursor: _Cursor = ..., - elementborderwidth: str | float = ..., + elementborderwidth: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: _ScreenUnits = ..., jump: bool = ..., orient: Literal["horizontal", "vertical"] = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + relief: _Relief = ..., repeatdelay: int = ..., repeatinterval: int = ..., takefocus: _TakeFocusValue = ..., troughcolor: str = ..., - width: str | float = ..., + width: _ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -3161,11 +3172,11 @@ class Text(Widget, XView, YView): *, autoseparators: bool = True, background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., blockcursor: bool = False, - border: str | float = ..., - borderwidth: str | float = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = "xterm", endline: int | Literal[""] = "", exportselection: bool = True, @@ -3175,39 +3186,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: str | float = 24, + height: _ScreenUnits = 24, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: _ScreenUnits = ..., inactiveselectbackground: str = ..., insertbackground: str = ..., - insertborderwidth: str | float = 0, + insertborderwidth: _ScreenUnits = 0, insertofftime: int = 300, insertontime: int = 600, insertunfocussed: Literal["none", "hollow", "solid"] = "none", - insertwidth: str | float = ..., + insertwidth: _ScreenUnits = ..., maxundo: int = 0, name: str = ..., - padx: str | float = 1, - pady: str | float = 1, - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + padx: _ScreenUnits = 1, + pady: _ScreenUnits = 1, + relief: _Relief = ..., selectbackground: str = ..., - selectborderwidth: str | float = ..., + selectborderwidth: _ScreenUnits = ..., selectforeground: str = ..., setgrid: bool = False, - spacing1: str | float = 0, - spacing2: str | float = 0, - spacing3: str | float = 0, + spacing1: _ScreenUnits = 0, + spacing2: _ScreenUnits = 0, + spacing3: _ScreenUnits = 0, startline: int | Literal[""] = "", state: Literal["normal", "disabled"] = "normal", - tabs: str | float | tuple[str | float, ...] = "", + # Literal inside Tuple doesn't actually work + tabs: _ScreenUnits | str | tuple[_ScreenUnits | str, ...] = "", tabstyle: Literal["tabular", "wordprocessor"] = "tabular", takefocus: _TakeFocusValue = "", undo: bool = False, width: int = 80, wrap: Literal["none", "char", "word"] = "char", - xscrollcommand: str | Callable[[float, float], object] = "", - yscrollcommand: str | Callable[[float, float], object] = "", + xscrollcommand: _XYScrollCommand = "", + yscrollcommand: _XYScrollCommand = "", ) -> None: ... @overload def configure( @@ -3216,49 +3228,49 @@ class Text(Widget, XView, YView): *, autoseparators: bool = ..., background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., blockcursor: bool = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = ..., endline: int | Literal[""] = ..., exportselection: bool = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: str | float = ..., + height: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: _ScreenUnits = ..., inactiveselectbackground: str = ..., insertbackground: str = ..., - insertborderwidth: str | float = ..., + insertborderwidth: _ScreenUnits = ..., insertofftime: int = ..., insertontime: int = ..., insertunfocussed: Literal["none", "hollow", "solid"] = ..., - insertwidth: str | float = ..., + insertwidth: _ScreenUnits = ..., maxundo: int = ..., - padx: str | float = ..., - pady: str | float = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., + relief: _Relief = ..., selectbackground: str = ..., - selectborderwidth: str | float = ..., + selectborderwidth: _ScreenUnits = ..., selectforeground: str = ..., setgrid: bool = ..., - spacing1: str | float = ..., - spacing2: str | float = ..., - spacing3: str | float = ..., + spacing1: _ScreenUnits = ..., + spacing2: _ScreenUnits = ..., + spacing3: _ScreenUnits = ..., startline: int | Literal[""] = ..., state: Literal["normal", "disabled"] = ..., - tabs: str | float | tuple[str | float, ...] = ..., + tabs: _ScreenUnits | str | tuple[_ScreenUnits | str, ...] = ..., tabstyle: Literal["tabular", "wordprocessor"] = ..., takefocus: _TakeFocusValue = ..., undo: bool = ..., width: int = ..., wrap: Literal["none", "char", "word"] = ..., - xscrollcommand: str | Callable[[float, float], object] = ..., - yscrollcommand: str | Callable[[float, float], object] = ..., + xscrollcommand: _XYScrollCommand = ..., + yscrollcommand: _XYScrollCommand = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -3467,10 +3479,10 @@ class Text(Widget, XView, YView): cnf: dict[str, Any] | None = None, *, align: Literal["baseline", "bottom", "center", "top"] = ..., - image: _Image | str = ..., + image: _ImageSpec = ..., name: str = ..., - padx: str | float = ..., - pady: str | float = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, str, str | int]] | None: ... def image_create( self, @@ -3478,10 +3490,10 @@ class Text(Widget, XView, YView): cnf: dict[str, Any] | None = {}, *, align: Literal["baseline", "bottom", "center", "top"] = ..., - image: _Image | str = ..., + image: _ImageSpec = ..., name: str = ..., - padx: str | float = ..., - pady: str | float = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., ) -> str: ... def image_names(self) -> tuple[str, ...]: ... def index(self, index: _TextIndex) -> str: ... @@ -3538,27 +3550,27 @@ class Text(Widget, XView, YView): *, background: str = ..., bgstipple: str = ..., - borderwidth: str | float = ..., - border: str | float = ..., # alias for borderwidth + borderwidth: _ScreenUnits = ..., + border: _ScreenUnits = ..., # alias for borderwidth elide: bool = ..., fgstipple: str = ..., font: _FontDescription = ..., foreground: str = ..., - justify: Literal["left", "center", "right"] = ..., - lmargin1: str | float = ..., - lmargin2: str | float = ..., + justify: _JustifyValue = ..., + lmargin1: _ScreenUnits = ..., + lmargin2: _ScreenUnits = ..., lmargincolor: str = ..., - offset: str | float = ..., + offset: _ScreenUnits = ..., overstrike: bool = ..., overstrikefg: str = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., - rmargin: str | float = ..., + relief: _Relief = ..., + rmargin: _ScreenUnits = ..., rmargincolor: str = ..., selectbackground: str = ..., selectforeground: str = ..., - spacing1: str | float = ..., - spacing2: str | float = ..., - spacing3: str | float = ..., + 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 +3613,8 @@ class Text(Widget, XView, YView): *, align: Literal["baseline", "bottom", "center", "top"] = ..., create: str = ..., - padx: str | float = ..., - pady: str | float = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., stretch: bool | Literal[0, 1] = ..., window: Misc | str = ..., ) -> dict[str, tuple[str, str, str, str, str | int]] | None: ... @@ -3614,8 +3626,8 @@ class Text(Widget, XView, YView): *, align: Literal["baseline", "bottom", "center", "top"] = ..., create: str = ..., - padx: str | float = ..., - pady: str | float = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., stretch: bool | Literal[0, 1] = ..., window: Misc | str = ..., ) -> None: ... @@ -3809,14 +3821,14 @@ class Spinbox(Widget, XView): *, activebackground: str = ..., background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., buttonbackground: str = ..., buttoncursor: _Cursor = "", - buttondownrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., - buttonuprelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + buttondownrelief: _Relief = ..., + buttonuprelief: _Relief = ..., # 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", @@ -3830,23 +3842,23 @@ class Spinbox(Widget, XView): from_: float = 0.0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: _ScreenUnits = ..., increment: float = 1.0, insertbackground: str = ..., - insertborderwidth: str | float = 0, + insertborderwidth: _ScreenUnits = 0, insertofftime: int = 300, insertontime: int = 600, - insertwidth: str | float = ..., + insertwidth: _ScreenUnits = ..., invalidcommand: _EntryValidateCommand = "", invcmd: _EntryValidateCommand = "", - justify: Literal["left", "center", "right"] = "left", + justify: _JustifyValue = "left", name: str = ..., readonlybackground: str = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "sunken", + relief: _Relief = "sunken", repeatdelay: int = 400, repeatinterval: int = 100, selectbackground: str = ..., - selectborderwidth: str | float = ..., + selectborderwidth: _ScreenUnits = ..., selectforeground: str = ..., state: Literal["normal", "disabled", "readonly"] = "normal", takefocus: _TakeFocusValue = "", @@ -3858,7 +3870,7 @@ class Spinbox(Widget, XView): values: list[str] | tuple[str, ...] = ..., width: int = 20, wrap: bool = False, - xscrollcommand: str | Callable[[float, float], object] = "", + xscrollcommand: _XYScrollCommand = "", ) -> None: ... @overload def configure( @@ -3867,14 +3879,14 @@ class Spinbox(Widget, XView): *, activebackground: str = ..., background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., buttonbackground: str = ..., buttoncursor: _Cursor = ..., - buttondownrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., - buttonuprelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + buttondownrelief: _Relief = ..., + buttonuprelief: _Relief = ..., command: Callable[[], object] | str | list[str] | tuple[str, ...] = ..., cursor: _Cursor = ..., disabledbackground: str = ..., @@ -3887,22 +3899,22 @@ class Spinbox(Widget, XView): from_: float = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: _ScreenUnits = ..., increment: float = ..., insertbackground: str = ..., - insertborderwidth: str | float = ..., + insertborderwidth: _ScreenUnits = ..., insertofftime: int = ..., insertontime: int = ..., - insertwidth: str | float = ..., + insertwidth: _ScreenUnits = ..., invalidcommand: _EntryValidateCommand = ..., invcmd: _EntryValidateCommand = ..., - justify: Literal["left", "center", "right"] = ..., + justify: _JustifyValue = ..., readonlybackground: str = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + relief: _Relief = ..., repeatdelay: int = ..., repeatinterval: int = ..., selectbackground: str = ..., - selectborderwidth: str | float = ..., + selectborderwidth: _ScreenUnits = ..., selectforeground: str = ..., state: Literal["normal", "disabled", "readonly"] = ..., takefocus: _TakeFocusValue = ..., @@ -3914,7 +3926,7 @@ class Spinbox(Widget, XView): values: list[str] | tuple[str, ...] = ..., width: int = ..., wrap: bool = ..., - xscrollcommand: str | Callable[[float, float], object] = ..., + xscrollcommand: _XYScrollCommand = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -3947,10 +3959,10 @@ class LabelFrame(Widget): cnf: dict[str, Any] | None = {}, *, background: str = ..., - bd: str | float = 2, + bd: _ScreenUnits = 2, bg: str = ..., - border: str | float = 2, - borderwidth: str | float = 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 +3970,21 @@ class LabelFrame(Widget): fg: str = ..., font: _FontDescription = "TkDefaultFont", foreground: str = ..., - height: str | float = 0, + height: _ScreenUnits = 0, highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = 0, - # 'ne' and 'en' are valid labelanchors, but only 'ne' is a valid `anchor` parameter. + 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: str | float = 0, - pady: str | float = 0, - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "groove", + padx: _ScreenUnits = 0, + pady: _ScreenUnits = 0, + relief: _Relief = "groove", takefocus: _TakeFocusValue = 0, text: float | str = "", visual: str | tuple[str, int] = "", # can't be changed with configure() - width: str | float = 0, + width: _ScreenUnits = 0, ) -> None: ... @overload def configure( @@ -3980,26 +3992,26 @@ class LabelFrame(Widget): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = ..., fg: str = ..., font: _FontDescription = ..., foreground: str = ..., - height: str | float = ..., + height: _ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: _ScreenUnits = ..., labelanchor: Literal["nw", "n", "ne", "en", "e", "es", "se", "s", "sw", "ws", "w", "wn"] = ..., labelwidget: Misc = ..., - padx: str | float = ..., - pady: str | float = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + padx: _ScreenUnits = ..., + pady: _ScreenUnits = ..., + relief: _Relief = ..., takefocus: _TakeFocusValue = ..., text: float | str = ..., - width: str | float = ..., + 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 +4024,27 @@ class PanedWindow(Widget): cnf: dict[str, Any] | None = {}, *, background: str = ..., - bd: str | float = 1, + bd: _ScreenUnits = 1, bg: str = ..., - border: str | float = 1, - borderwidth: str | float = 1, + border: _ScreenUnits = 1, + borderwidth: _ScreenUnits = 1, cursor: _Cursor = "", - handlepad: str | float = 8, - handlesize: str | float = 8, - height: str | float = "", + handlepad: _ScreenUnits = 8, + handlesize: _ScreenUnits = 8, + height: _ScreenUnits = "", name: str = ..., opaqueresize: bool = True, orient: Literal["horizontal", "vertical"] = "horizontal", proxybackground: str = "", - proxyborderwidth: str | float = 2, - proxyrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", + proxyborderwidth: _ScreenUnits = 2, + proxyrelief: _Relief = "flat", + relief: _Relief = "flat", sashcursor: _Cursor = "", - sashpad: str | float = 0, - sashrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = "flat", - sashwidth: str | float = 3, + sashpad: _ScreenUnits = 0, + sashrelief: _Relief = "flat", + sashwidth: _ScreenUnits = 3, showhandle: bool = False, - width: str | float = "", + width: _ScreenUnits = "", ) -> None: ... @overload def configure( @@ -4040,26 +4052,26 @@ class PanedWindow(Widget): cnf: dict[str, Any] | None = None, *, background: str = ..., - bd: str | float = ..., + bd: _ScreenUnits = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: _ScreenUnits = ..., + borderwidth: _ScreenUnits = ..., cursor: _Cursor = ..., - handlepad: str | float = ..., - handlesize: str | float = ..., - height: str | float = ..., + handlepad: _ScreenUnits = ..., + handlesize: _ScreenUnits = ..., + height: _ScreenUnits = ..., opaqueresize: bool = ..., orient: Literal["horizontal", "vertical"] = ..., proxybackground: str = ..., - proxyborderwidth: str | float = ..., - proxyrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + proxyborderwidth: _ScreenUnits = ..., + proxyrelief: _Relief = ..., + relief: _Relief = ..., sashcursor: _Cursor = ..., - sashpad: str | float = ..., - sashrelief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., - sashwidth: str | float = ..., + sashpad: _ScreenUnits = ..., + sashrelief: _Relief = ..., + sashwidth: _ScreenUnits = ..., showhandle: bool = ..., - width: str | float = ..., + 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 bebcc1194251..c46239df81eb 100644 --- a/stdlib/tkinter/ttk.pyi +++ b/stdlib/tkinter/ttk.pyi @@ -38,16 +38,15 @@ def tclobjs_to_py(adict: dict[Any, Any]) -> dict[Any, Any]: ... def setup_master(master=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] + 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 -_TtkCompound: TypeAlias = Literal["", "text", "image", "top", "left", "center", "right", "bottom", "none"] +# from ttk_widget (aka ttk::widget) manual page, differs from tkinter._Compound +_TtkCompound: TypeAlias = Literal["", "text", "image", tkinter._Compound] class Style: master: Incomplete @@ -80,11 +79,11 @@ class Button(Widget): master: tkinter.Misc | None = None, *, class_: str = "", - command: str | Callable[[], Any] = "", + command: tkinter._ButtonCommand = "", compound: _TtkCompound = "", cursor: tkinter._Cursor = "", default: Literal["normal", "active", "disabled"] = "normal", - image: tkinter._Image | str = "", + image: tkinter._ImageSpec = "", name: str = ..., padding=..., # undocumented state: str = "normal", @@ -100,11 +99,11 @@ class Button(Widget): self, cnf: dict[str, Any] | None = None, *, - command: str | Callable[[], Any] = ..., + command: tkinter._ButtonCommand = ..., compound: _TtkCompound = ..., cursor: tkinter._Cursor = ..., default: Literal["normal", "active", "disabled"] = ..., - image: tkinter._Image | str = ..., + image: tkinter._ImageSpec = ..., padding=..., state: str = ..., style: str = ..., @@ -125,10 +124,10 @@ class Checkbutton(Widget): master: tkinter.Misc | None = None, *, class_: str = "", - command: str | Callable[[], Any] = "", + command: tkinter._ButtonCommand = "", compound: _TtkCompound = "", cursor: tkinter._Cursor = "", - image: tkinter._Image | str = "", + image: tkinter._ImageSpec = "", name: str = ..., offvalue: Any = 0, onvalue: Any = 1, @@ -150,10 +149,10 @@ class Checkbutton(Widget): self, cnf: dict[str, Any] | None = None, *, - command: str | Callable[[], Any] = ..., + command: tkinter._ButtonCommand = ..., compound: _TtkCompound = ..., cursor: tkinter._Cursor = ..., - image: tkinter._Image | str = ..., + image: tkinter._ImageSpec = ..., offvalue: Any = ..., onvalue: Any = ..., padding=..., @@ -194,7 +193,7 @@ class Entry(Widget, tkinter.Entry): validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = "none", validatecommand: tkinter._EntryValidateCommand = "", width: int = 20, - xscrollcommand: str | Callable[[float, float], object] = "", + xscrollcommand: tkinter._XYScrollCommand = "", ) -> None: ... @overload # type: ignore[override] def configure( @@ -216,7 +215,7 @@ class Entry(Widget, tkinter.Entry): validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ..., validatecommand: tkinter._EntryValidateCommand = ..., width: int = ..., - xscrollcommand: str | Callable[[float, float], object] = ..., + xscrollcommand: tkinter._XYScrollCommand = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -241,7 +240,7 @@ class Entry(Widget, tkinter.Entry): validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ..., validatecommand: tkinter._EntryValidateCommand = ..., width: int = ..., - xscrollcommand: str | Callable[[float, float], object] = ..., + xscrollcommand: tkinter._XYScrollCommand = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def config(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -274,7 +273,7 @@ class Combobox(Entry): validatecommand: tkinter._EntryValidateCommand = ..., # undocumented values: list[str] | tuple[str, ...] = ..., width: int = 20, - xscrollcommand: str | Callable[[float, float], object] = ..., # undocumented + xscrollcommand: tkinter._XYScrollCommand = ..., # undocumented ) -> None: ... @overload # type: ignore[override] def configure( @@ -299,7 +298,7 @@ class Combobox(Entry): validatecommand: tkinter._EntryValidateCommand = ..., values: list[str] | tuple[str, ...] = ..., width: int = ..., - xscrollcommand: str | Callable[[float, float], object] = ..., + xscrollcommand: tkinter._XYScrollCommand = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -327,7 +326,7 @@ class Combobox(Entry): validatecommand: tkinter._EntryValidateCommand = ..., values: list[str] | tuple[str, ...] = ..., width: int = ..., - xscrollcommand: str | Callable[[float, float], object] = ..., + xscrollcommand: tkinter._XYScrollCommand = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def config(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -341,32 +340,32 @@ class Frame(Widget): self, master: tkinter.Misc | None = None, *, - border: str | float = ..., - borderwidth: str | float = ..., + border: tkinter._ScreenUnits = ..., + borderwidth: tkinter._ScreenUnits = ..., class_: str = "", cursor: tkinter._Cursor = "", - height: str | float = 0, + height: tkinter._ScreenUnits = 0, name: str = ..., padding: _Padding = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + relief: tkinter._Relief = ..., style: str = "", takefocus: tkinter._TakeFocusValue = "", - width: str | float = 0, + width: tkinter._ScreenUnits = 0, ) -> None: ... @overload def configure( self, cnf: dict[str, Any] | None = None, *, - border: str | float = ..., - borderwidth: str | float = ..., + border: tkinter._ScreenUnits = ..., + borderwidth: tkinter._ScreenUnits = ..., cursor: tkinter._Cursor = ..., - height: str | float = ..., + height: tkinter._ScreenUnits = ..., padding: _Padding = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + relief: tkinter._Relief = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., - width: str | float = ..., + width: tkinter._ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -377,20 +376,20 @@ class Label(Widget): self, master: tkinter.Misc | None = None, *, - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., + anchor: tkinter._Anchor = ..., background: str = "", - border: str | float = ..., # alias for borderwidth - borderwidth: str | float = ..., # undocumented + border: tkinter._ScreenUnits = ..., # alias for borderwidth + borderwidth: tkinter._ScreenUnits = ..., # undocumented class_: str = "", compound: _TtkCompound = "", cursor: tkinter._Cursor = "", font: _FontDescription = ..., foreground: str = "", - image: tkinter._Image | str = "", + image: tkinter._ImageSpec = "", justify: Literal["left", "center", "right"] = ..., name: str = ..., padding: _Padding = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + relief: tkinter._Relief = ..., state: str = "normal", style: str = "", takefocus: tkinter._TakeFocusValue = "", @@ -398,25 +397,25 @@ class Label(Widget): textvariable: tkinter.Variable = ..., underline: int = -1, width: int | Literal[""] = "", - wraplength: str | float = ..., + wraplength: tkinter._ScreenUnits = ..., ) -> None: ... @overload def configure( self, cnf: dict[str, Any] | None = None, *, - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., + anchor: tkinter._Anchor = ..., background: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: tkinter._ScreenUnits = ..., + borderwidth: tkinter._ScreenUnits = ..., compound: _TtkCompound = ..., cursor: tkinter._Cursor = ..., font: _FontDescription = ..., foreground: str = ..., - image: tkinter._Image | str = ..., + image: tkinter._ImageSpec = ..., justify: Literal["left", "center", "right"] = ..., padding: _Padding = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + relief: tkinter._Relief = ..., state: str = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., @@ -424,7 +423,7 @@ class Label(Widget): textvariable: tkinter.Variable = ..., underline: int = ..., width: int | Literal[""] = ..., - wraplength: str | float = ..., + wraplength: tkinter._ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -435,40 +434,40 @@ class Labelframe(Widget): self, master: tkinter.Misc | None = None, *, - border: str | float = ..., - borderwidth: str | float = ..., # undocumented + border: tkinter._ScreenUnits = ..., + borderwidth: tkinter._ScreenUnits = ..., # undocumented class_: str = "", cursor: tkinter._Cursor = "", - height: str | float = 0, + height: tkinter._ScreenUnits = 0, labelanchor: Literal["nw", "n", "ne", "en", "e", "es", "se", "s", "sw", "ws", "w", "wn"] = ..., labelwidget: tkinter.Misc = ..., name: str = ..., padding: _Padding = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., # undocumented + relief: tkinter._Relief = ..., # undocumented style: str = "", takefocus: tkinter._TakeFocusValue = "", text: float | str = "", underline: int = -1, - width: str | float = 0, + width: tkinter._ScreenUnits = 0, ) -> None: ... @overload def configure( self, cnf: dict[str, Any] | None = None, *, - border: str | float = ..., - borderwidth: str | float = ..., + border: tkinter._ScreenUnits = ..., + borderwidth: tkinter._ScreenUnits = ..., cursor: tkinter._Cursor = ..., - height: str | float = ..., + height: tkinter._ScreenUnits = ..., labelanchor: Literal["nw", "n", "ne", "en", "e", "es", "se", "s", "sw", "ws", "w", "wn"] = ..., labelwidget: tkinter.Misc = ..., padding: _Padding = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + relief: tkinter._Relief = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., text: float | str = ..., underline: int = ..., - width: str | float = ..., + width: tkinter._ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -485,7 +484,7 @@ class Menubutton(Widget): compound: _TtkCompound = "", cursor: tkinter._Cursor = "", direction: Literal["above", "below", "left", "right", "flush"] = "below", - image: tkinter._Image | str = "", + image: tkinter._ImageSpec = "", menu: tkinter.Menu = ..., name: str = ..., padding=..., # undocumented @@ -505,7 +504,7 @@ class Menubutton(Widget): compound: _TtkCompound = ..., cursor: tkinter._Cursor = ..., direction: Literal["above", "below", "left", "right", "flush"] = ..., - image: tkinter._Image | str = ..., + image: tkinter._ImageSpec = ..., menu: tkinter.Menu = ..., padding=..., state: str = ..., @@ -560,7 +559,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: Literal["top", "left", "center", "right", "bottom", "none"] = ..., + compound: tkinter._Compound = ..., underline: int = ..., ) -> None: ... def forget(self, tab_id) -> None: ... # type: ignore[override] @@ -630,7 +629,7 @@ class Progressbar(Widget): *, class_: str = "", cursor: tkinter._Cursor = "", - length: str | float = 100, + length: tkinter._ScreenUnits = 100, maximum: float = 100, mode: Literal["determinate", "indeterminate"] = "determinate", name: str = ..., @@ -647,7 +646,7 @@ class Progressbar(Widget): cnf: dict[str, Any] | None = None, *, cursor: tkinter._Cursor = ..., - length: str | float = ..., + length: tkinter._ScreenUnits = ..., maximum: float = ..., mode: Literal["determinate", "indeterminate"] = ..., orient: Literal["horizontal", "vertical"] = ..., @@ -670,10 +669,10 @@ class Radiobutton(Widget): master: tkinter.Misc | None = None, *, class_: str = "", - command: str | Callable[[], Any] = "", + command: tkinter._ButtonCommand = "", compound: _TtkCompound = "", cursor: tkinter._Cursor = "", - image: tkinter._Image | str = "", + image: tkinter._ImageSpec = "", name: str = ..., padding=..., # undocumented state: str = "normal", @@ -691,10 +690,10 @@ class Radiobutton(Widget): self, cnf: dict[str, Any] | None = None, *, - command: str | Callable[[], Any] = ..., + command: tkinter._ButtonCommand = ..., compound: _TtkCompound = ..., cursor: tkinter._Cursor = ..., - image: tkinter._Image | str = ..., + image: tkinter._ImageSpec = ..., padding=..., state: str = ..., style: str = ..., @@ -721,7 +720,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: tkinter._ScreenUnits = 100, name: str = ..., orient: Literal["horizontal", "vertical"] = "horizontal", state: str = ..., # undocumented @@ -739,7 +738,7 @@ class Scale(Widget, tkinter.Scale): # type: ignore[misc] command: str | Callable[[str], object] = ..., cursor: tkinter._Cursor = ..., from_: float = ..., - length: str | float = ..., + length: tkinter._ScreenUnits = ..., orient: Literal["horizontal", "vertical"] = ..., state: str = ..., style: str = ..., @@ -759,7 +758,7 @@ class Scale(Widget, tkinter.Scale): # type: ignore[misc] command: str | Callable[[str], object] = ..., cursor: tkinter._Cursor = ..., from_: float = ..., - length: str | float = ..., + length: tkinter._ScreenUnits = ..., orient: Literal["horizontal", "vertical"] = ..., state: str = ..., style: str = ..., @@ -893,7 +892,7 @@ class Spinbox(Entry): values: list[str] | tuple[str, ...] = ..., width: int = ..., # undocumented wrap: bool = False, - xscrollcommand: str | Callable[[float, float], object] = "", + xscrollcommand: tkinter._XYScrollCommand = "", ) -> None: ... @overload # type: ignore[override] def configure( @@ -922,7 +921,7 @@ class Spinbox(Entry): values: list[str] | tuple[str, ...] = ..., width: int = ..., wrap: bool = ..., - xscrollcommand: str | Callable[[float, float], object] = ..., + xscrollcommand: tkinter._XYScrollCommand = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -949,7 +948,7 @@ class _TreeviewTagDict(TypedDict): class _TreeviewHeaderDict(TypedDict): text: str image: list[str] | Literal[""] - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] + anchor: tkinter._Anchor command: str state: str # Doesn't seem to appear anywhere else than in these dicts @@ -958,7 +957,7 @@ class _TreeviewColumnDict(TypedDict): width: int minwidth: int stretch: bool # actually 0 or 1 - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] + anchor: tkinter._Anchor id: str class Treeview(Widget, tkinter.XView, tkinter.YView): @@ -981,8 +980,8 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): show: Literal["tree", "headings", "tree headings", ""] | list[str] | tuple[str, ...] = ("tree", "headings"), style: str = "", takefocus: tkinter._TakeFocusValue = ..., - xscrollcommand: str | Callable[[float, float], object] = "", - yscrollcommand: str | Callable[[float, float], object] = "", + xscrollcommand: tkinter._XYScrollCommand = "", + yscrollcommand: tkinter._XYScrollCommand = "", ) -> None: ... @overload def configure( @@ -998,8 +997,8 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): show: Literal["tree", "headings", "tree headings", ""] | list[str] | tuple[str, ...] = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., - xscrollcommand: str | Callable[[float, float], object] = ..., - yscrollcommand: str | Callable[[float, float], object] = ..., + xscrollcommand: tkinter._XYScrollCommand = ..., + yscrollcommand: tkinter._XYScrollCommand = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... @@ -1026,7 +1025,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): width: int = ..., minwidth: int = ..., stretch: bool = ..., - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., + anchor: tkinter._Anchor = ..., # id is read-only ) -> _TreeviewColumnDict | None: ... def delete(self, *items: str | int) -> None: ... @@ -1055,8 +1054,8 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): option: None = None, *, text: str = ..., - image: tkinter._Image | str = ..., - anchor: Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] = ..., + image: tkinter._ImageSpec = ..., + anchor: tkinter._Anchor = ..., command: str | Callable[[], object] = ..., ) -> None: ... # Internal Method. Leave untyped: @@ -1074,7 +1073,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): *, id: str | int = ..., # same as iid text: str = ..., - image: tkinter._Image | str = ..., + image: tkinter._ImageSpec = ..., values: list[Any] | tuple[Any, ...] = ..., open: bool = ..., tags: str | list[str] | tuple[str, ...] = ..., @@ -1100,7 +1099,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): option: None = None, *, text: str = ..., - image: tkinter._Image | str = ..., + image: tkinter._ImageSpec = ..., values: list[Any] | tuple[Any, ...] | Literal[""] = ..., open: bool = ..., tags: str | list[str] | tuple[str, ...] = ..., @@ -1160,7 +1159,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): foreground: str = ..., background: str = ..., font: _FontDescription = ..., - image: tkinter._Image | str = ..., + image: tkinter._ImageSpec = ..., ) -> _TreeviewTagDict | MaybeNone: ... # can be None but annoying to check @overload def tag_has(self, tagname: str, item: None = None) -> tuple[str, ...]: ... @@ -1179,18 +1178,18 @@ class LabeledScale(Frame): from_: float = 0, to: float = 10, *, - border: str | float = ..., - borderwidth: str | float = ..., + border: tkinter._ScreenUnits = ..., + borderwidth: tkinter._ScreenUnits = ..., class_: str = "", compound: Literal["top", "bottom"] = "top", cursor: tkinter._Cursor = "", - height: str | float = 0, + height: tkinter._ScreenUnits = 0, name: str = ..., padding: _Padding = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + relief: tkinter._Relief = ..., style: str = "", takefocus: tkinter._TakeFocusValue = "", - width: str | float = 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 5b7b5a71f8b8..5b826ad71b3b 100644 --- a/stubs/ttkthemes/ttkthemes/themed_tk.pyi +++ b/stubs/ttkthemes/ttkthemes/themed_tk.pyi @@ -1,5 +1,5 @@ import tkinter -from typing import Any, Literal +from typing import Any from ._widget import ThemedWidget @@ -31,21 +31,21 @@ class ThemedTk(tkinter.Tk, ThemedWidget): toplevel: bool | None = ..., theme: str | None = ..., background: str = ..., - bd: str | float = ..., + bd: tkinter._ScreenUnits = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: tkinter._ScreenUnits = ..., + borderwidth: tkinter._ScreenUnits = ..., cursor: tkinter._Cursor = ..., - height: str | float = ..., + height: tkinter._ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: tkinter._ScreenUnits = ..., menu: tkinter.Menu = ..., - padx: str | float = ..., - pady: str | float = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + padx: tkinter._ScreenUnits = ..., + pady: tkinter._ScreenUnits = ..., + relief: tkinter._Relief = ..., takefocus: tkinter._TakeFocusValue = ..., - width: str | float = ..., + width: tkinter._ScreenUnits = ..., ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... def cget(self, k: str) -> Any: ... def configure( # type: ignore[override] @@ -56,21 +56,21 @@ class ThemedTk(tkinter.Tk, ThemedWidget): toplevel: bool | None = ..., theme: str | None = ..., background: str = ..., - bd: str | float = ..., + bd: tkinter._ScreenUnits = ..., bg: str = ..., - border: str | float = ..., - borderwidth: str | float = ..., + border: tkinter._ScreenUnits = ..., + borderwidth: tkinter._ScreenUnits = ..., cursor: tkinter._Cursor = ..., - height: str | float = ..., + height: tkinter._ScreenUnits = ..., highlightbackground: str = ..., highlightcolor: str = ..., - highlightthickness: str | float = ..., + highlightthickness: tkinter._ScreenUnits = ..., menu: tkinter.Menu = ..., - padx: str | float = ..., - pady: str | float = ..., - relief: Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] = ..., + padx: tkinter._ScreenUnits = ..., + pady: tkinter._ScreenUnits = ..., + relief: tkinter._Relief = ..., takefocus: tkinter._TakeFocusValue = ..., - width: str | float = ..., + 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 923777e73d5e13305df20dcf68a57a4e3cb285d8 Mon Sep 17 00:00:00 2001 From: donBarbos Date: Wed, 27 Aug 2025 09:57:00 +0400 Subject: [PATCH 5/5] Remove _JustifyValue alias --- stdlib/tkinter/__init__.pyi | 43 ++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 9fd5ed682d65..a7e63f66bb42 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -176,7 +176,6 @@ EXCEPTION: Final = _tkinter.EXCEPTION # 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 -_JustifyValue: TypeAlias = Literal["left", "center", "right"] # manual page: Tk_GetJustify _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 @@ -1277,7 +1276,7 @@ class Button(Widget): highlightcolor: str = ..., highlightthickness: _ScreenUnits = 1, image: _ImageSpec = "", - justify: _JustifyValue = "center", + justify: Literal["left", "center", "right"] = "center", name: str = ..., overrelief: _Relief | Literal[""] = "", padx: _ScreenUnits = ..., @@ -1323,7 +1322,7 @@ class Button(Widget): highlightcolor: str = ..., highlightthickness: _ScreenUnits = ..., image: _ImageSpec = ..., - justify: _JustifyValue = ..., + justify: Literal["left", "center", "right"] = ..., overrelief: _Relief | Literal[""] = ..., padx: _ScreenUnits = ..., pady: _ScreenUnits = ..., @@ -1902,7 +1901,7 @@ class Canvas(Widget, XView, YView): disabledstipple: str = ..., fill: str = ..., font: _FontDescription = ..., - justify: _JustifyValue = ..., + justify: Literal["left", "center", "right"] = ..., offset: _ScreenUnits = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., @@ -1924,7 +1923,7 @@ class Canvas(Widget, XView, YView): disabledstipple: str = ..., fill: str = ..., font: _FontDescription = ..., - justify: _JustifyValue = ..., + justify: Literal["left", "center", "right"] = ..., offset: _ScreenUnits = ..., state: Literal["normal", "hidden", "disabled"] = ..., stipple: str = ..., @@ -2029,7 +2028,7 @@ class Checkbutton(Widget): highlightthickness: _ScreenUnits = 1, image: _ImageSpec = "", indicatoron: bool = True, - justify: _JustifyValue = "center", + justify: Literal["left", "center", "right"] = "center", name: str = ..., offrelief: _Relief = ..., # The checkbutton puts a value to its variable when it's checked or @@ -2088,7 +2087,7 @@ class Checkbutton(Widget): highlightthickness: _ScreenUnits = ..., image: _ImageSpec = ..., indicatoron: bool = ..., - justify: _JustifyValue = ..., + justify: Literal["left", "center", "right"] = ..., offrelief: _Relief = ..., offvalue: Any = ..., onvalue: Any = ..., @@ -2146,7 +2145,7 @@ class Entry(Widget, XView): insertwidth: _ScreenUnits = ..., invalidcommand: _EntryValidateCommand = "", invcmd: _EntryValidateCommand = "", # same as invalidcommand - justify: _JustifyValue = "left", + justify: Literal["left", "center", "right"] = "left", name: str = ..., readonlybackground: str = ..., relief: _Relief = "sunken", @@ -2190,7 +2189,7 @@ class Entry(Widget, XView): insertwidth: _ScreenUnits = ..., invalidcommand: _EntryValidateCommand = ..., invcmd: _EntryValidateCommand = ..., - justify: _JustifyValue = ..., + justify: Literal["left", "center", "right"] = ..., readonlybackground: str = ..., relief: _Relief = ..., selectbackground: str = ..., @@ -2307,7 +2306,7 @@ class Label(Widget): highlightcolor: str = ..., highlightthickness: _ScreenUnits = 0, image: _ImageSpec = "", - justify: _JustifyValue = "center", + justify: Literal["left", "center", "right"] = "center", name: str = ..., padx: _ScreenUnits = 1, pady: _ScreenUnits = 1, @@ -2345,7 +2344,7 @@ class Label(Widget): highlightcolor: str = ..., highlightthickness: _ScreenUnits = ..., image: _ImageSpec = ..., - justify: _JustifyValue = ..., + justify: Literal["left", "center", "right"] = ..., padx: _ScreenUnits = ..., pady: _ScreenUnits = ..., relief: _Relief = ..., @@ -2383,7 +2382,7 @@ class Listbox(Widget, XView, YView): highlightbackground: str = ..., highlightcolor: str = ..., highlightthickness: _ScreenUnits = ..., - justify: _JustifyValue = "left", + justify: Literal["left", "center", "right"] = "left", # There's no tkinter.ListVar, but seems like bare tkinter.Variable # actually works for this: # @@ -2434,7 +2433,7 @@ class Listbox(Widget, XView, YView): highlightbackground: str = ..., highlightcolor: str = ..., highlightthickness: _ScreenUnits = ..., - justify: _JustifyValue = ..., + justify: Literal["left", "center", "right"] = ..., listvariable: Variable = ..., relief: _Relief = ..., selectbackground: str = ..., @@ -2773,7 +2772,7 @@ class Menubutton(Widget): highlightthickness: _ScreenUnits = 0, image: _ImageSpec = "", indicatoron: bool = ..., - justify: _JustifyValue = ..., + justify: Literal["left", "center", "right"] = ..., menu: Menu = ..., name: str = ..., padx: _ScreenUnits = ..., @@ -2814,7 +2813,7 @@ class Menubutton(Widget): highlightthickness: _ScreenUnits = ..., image: _ImageSpec = ..., indicatoron: bool = ..., - justify: _JustifyValue = ..., + justify: Literal["left", "center", "right"] = ..., menu: Menu = ..., padx: _ScreenUnits = ..., pady: _ScreenUnits = ..., @@ -2851,7 +2850,7 @@ class Message(Widget): highlightbackground: str = ..., highlightcolor: str = ..., highlightthickness: _ScreenUnits = 0, - justify: _JustifyValue = "left", + justify: Literal["left", "center", "right"] = "left", name: str = ..., padx: _ScreenUnits = ..., pady: _ScreenUnits = ..., @@ -2881,7 +2880,7 @@ class Message(Widget): highlightbackground: str = ..., highlightcolor: str = ..., highlightthickness: _ScreenUnits = ..., - justify: _JustifyValue = ..., + justify: Literal["left", "center", "right"] = ..., padx: _ScreenUnits = ..., pady: _ScreenUnits = ..., relief: _Relief = ..., @@ -2922,7 +2921,7 @@ class Radiobutton(Widget): highlightthickness: _ScreenUnits = 1, image: _ImageSpec = "", indicatoron: bool = True, - justify: _JustifyValue = "center", + justify: Literal["left", "center", "right"] = "center", name: str = ..., offrelief: _Relief = ..., overrelief: _Relief | Literal[""] = "", @@ -2970,7 +2969,7 @@ class Radiobutton(Widget): highlightthickness: _ScreenUnits = ..., image: _ImageSpec = ..., indicatoron: bool = ..., - justify: _JustifyValue = ..., + justify: Literal["left", "center", "right"] = ..., offrelief: _Relief = ..., overrelief: _Relief | Literal[""] = ..., padx: _ScreenUnits = ..., @@ -3556,7 +3555,7 @@ class Text(Widget, XView, YView): fgstipple: str = ..., font: _FontDescription = ..., foreground: str = ..., - justify: _JustifyValue = ..., + justify: Literal["left", "center", "right"] = ..., lmargin1: _ScreenUnits = ..., lmargin2: _ScreenUnits = ..., lmargincolor: str = ..., @@ -3851,7 +3850,7 @@ class Spinbox(Widget, XView): insertwidth: _ScreenUnits = ..., invalidcommand: _EntryValidateCommand = "", invcmd: _EntryValidateCommand = "", - justify: _JustifyValue = "left", + justify: Literal["left", "center", "right"] = "left", name: str = ..., readonlybackground: str = ..., relief: _Relief = "sunken", @@ -3908,7 +3907,7 @@ class Spinbox(Widget, XView): insertwidth: _ScreenUnits = ..., invalidcommand: _EntryValidateCommand = ..., invcmd: _EntryValidateCommand = ..., - justify: _JustifyValue = ..., + justify: Literal["left", "center", "right"] = ..., readonlybackground: str = ..., relief: _Relief = ..., repeatdelay: int = ...,