From b9a0b0065447e4a00406afc49063bb6d67e85fb8 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 7 Apr 2021 23:38:19 -0700 Subject: [PATCH 01/15] More complete type stubs for tkinter Canvas methods. --- stdlib/tkinter/__init__.pyi | 145 +++++++++++++++++++++++++++++++++--- 1 file changed, 134 insertions(+), 11 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 56e8d60b9779..69eb4d665733 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -21,7 +21,8 @@ from typing import ( Union, overload, ) -from typing_extensions import Literal, TypedDict + +from typing_extensions import Literal, TypedDict, NewType # Using anything from tkinter.font in this file means that 'import tkinter' # seems to also load tkinter.font. That's not how it actually works, but @@ -124,6 +125,8 @@ _ScreenUnits = Union[str, float] # manual page: Tk_GetPixels _XYScrollCommand = Union[str, Callable[[float, float], Any]] # -xscrollcommand and -yscrollcommand in 'options' manual page _TakeFocusValue = Union[int, Literal[""], Callable[[str], Optional[bool]]] # -takefocus in manual page named 'options' +_ObjectId = NewType("ObjectId", int) + class EventType(str, Enum): Activate: str = ... ButtonPress: str = ... @@ -1112,17 +1115,137 @@ class Canvas(Widget, XView, YView): def canvasx(self, screenx, gridspacing: Optional[Any] = ...): ... def canvasy(self, screeny, gridspacing: Optional[Any] = ...): ... def coords(self, *args): ... - def create_arc(self, *args, **kw): ... - def create_bitmap(self, *args, **kw): ... - def create_image(self, *args, **kw): ... - def create_line(self, *args, **kw): ... - def create_oval(self, *args, **kw): ... - def create_polygon(self, *args, **kw): ... - def create_rectangle(self, *args, **kw): ... - def create_text(self, *args, **kw): ... - def create_window(self, *args, **kw): ... + def create_arc(self, *args, **kw) -> _ObjectId: ... + def create_bitmap(self, *args, **kw) -> _ObjectId: ... + def create_image(self, *args, **kw) -> _ObjectId: ... + def create_line(self, x0: int, y0: int, x1: int, y1: int, /, + activedash: _Color = ..., + activefill: _Color = ..., + activestipple: str = ..., + activewidth: Union[int, str] = ..., + arrow: Literal["first", "last", "both"] = ..., + arrowshape: Tuple[int, int, int] = ..., + capstyle: Literal["round", "projecting", "butt"] = ..., + dash: Union[Tuple[int], Tuple[int, int], Tuple[int, int, int, int]] = ..., + dashoffset: Union[int, str] = ..., + disableddash: _Color = ..., + disabledfill: _Color = ..., + disabledstipple: _Bitmap = ..., + disabledwidth: Union[int, str] = ..., + fill: _Color = ..., + joinstyle: Literal["round", "bevel", "miter"] = ..., + offset: Union[int, str] = ..., + smooth: Literal[0, 1] = ..., + splinesteps: int = ..., + state: Literal["normal", "active", "disabled"] = ..., + stipple: _Bitmap = ..., + tags: Union[str, Tuple[str, ...]] = ..., + width: Union[int, str] = ..., + ) -> _ObjectId: ... + def create_oval(self, x0: int, y0: int, x1: int, y1: int, /, + activedash: _Color = ..., + activefill: _Color = ..., + activeoutline: _Color = ..., + activeoutlinestipple: _Color = ..., + activestipple: str = ..., + activewidth: Union[int, str] = ..., + dash: Union[Tuple[int], Tuple[int, int], Tuple[int, int, int, int]] = ..., + dashoffset: Union[int, str] = ..., + disableddash: _Color = ..., + disabledfill: _Color = ..., + disabledoutline: _Color = ..., + disabledoutlinestipple: _Color = ..., + disabledstipple: _Bitmap = ..., + disabledwidth: Union[int, str] = ..., + fill: _Color = ..., + offset: Union[int, str] = ..., + outline: _Color = ..., + outlineoffset: Union[int, str] = ..., + outlinestipple: _Bitmap = ..., + state: Literal["normal", "active", "disabled"] = ..., + stipple: _Bitmap = ..., + tags: Union[str, Tuple[str, ...]] = ..., + width: Union[int, str] = ..., + ) -> _ObjectId: ... + def create_polygon(self, x0: int, y0: int, x1: int, y1: int, *args: int, /, + activedash: _Color = ..., + activefill: _Color = ..., + activeoutline: _Color = ..., + activeoutlinestipple: _Color = ..., + activestipple: str = ..., + activewidth: Union[int, str] = ..., + dash: Union[Tuple[int], Tuple[int, int], Tuple[int, int, int, int]] = ..., + dashoffset: Union[int, str] = ..., + disableddash: _Color = ..., + disabledfill: _Color = ..., + disabledoutline: _Color = ..., + disabledoutlinestipple: _Color = ..., + disabledstipple: _Bitmap = ..., + disabledwidth: Union[int, str] = ..., + fill: _Color = ..., + joinstyle: Literal["round", "bevel", "miter"] = ..., + offset: Union[int, str] = ..., + outline: _Color = ..., + outlineoffset: Union[int, str] = ..., + outlinestipple: _Bitmap = ..., + smooth: Literal[0, 1] = ..., + splinesteps: int = ..., + state: Literal["normal", "active", "disabled"] = ..., + stipple: _Bitmap = ..., + tags: Union[str, Tuple[str, ...]] = ..., + width: Union[int, str] = ..., + ) -> _ObjectId: ... + def create_rectangle(self, x0: int, y0: int, x1: int, y1: int, /, + activedash: _Color = ..., + activefill: _Color = ..., + activeoutline: _Color = ..., + activeoutlinestipple: _Color = ..., + activestipple: str = ..., + activewidth: Union[int, str] = ..., + dash: Union[Tuple[int], Tuple[int, int], Tuple[int, int, int, int]] = ..., + dashoffset: Union[int, str] = ..., + disableddash: _Color = ..., + disabledfill: _Color = ..., + disabledoutline: _Color = ..., + disabledoutlinestipple: _Color = ..., + disabledstipple: _Bitmap = ..., + disabledwidth: Union[int, str] = ..., + fill: _Color = ..., + offset: Union[int, str] = ..., + outline: _Color = ..., + outlineoffset: Union[int, str] = ..., + outlinestipple: _Bitmap = ..., + state: Literal["normal", "active", "disabled"] = ..., + stipple: _Bitmap = ..., + tags: Union[str, Tuple[str, ...]] = ..., + width: Union[int, str] = ..., + ) -> _ObjectId: ... + def create_text(self, x: int, y: int, / + activefill: _Color = ..., + activestipple: str = ..., + anchor: _Anchor = ..., + disabledfill: _Color = ..., + disabledstipple: _Bitmap = ..., + fill: _Color = ..., + font: _FontDescription = ..., + justify: Literal["left", "center", "right"] = ..., + offset: Union[int, str] = ..., + state: Literal["normal", "active", "disabled"] = ..., + stipple: _Bitmap = ..., + tags: Union[str, Tuple[str, ...]] = ..., + text: str = ..., + width: Union[int, str] = ..., + ) -> _ObjectId: ... + def create_window(self, x: int, y: int, /, + anchor: _Anchor = ..., + height: Union[int, str] = ..., + state: Literal["normal", "active", "disabled"] = ..., + tags: Union[str, Tuple[str, ...]] = ..., + width: Union[int, str] = ..., + window: Widget = ..., + ) -> _ObjectId: ... def dchars(self, *args): ... - def delete(self, *args): ... + def delete(self, *args: Union[_ObjectId, typing.Iterable[_ObjectId]]) -> None: ... def dtag(self, *args): ... def find(self, *args): ... def find_above(self, tagOrId): ... From ea23e776d6834e870792b02728a57ea35469f0ef Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 9 Apr 2021 18:54:50 -0700 Subject: [PATCH 02/15] Some feedback. --- stdlib/tkinter/__init__.pyi | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 69eb4d665733..ba15c3ca26ea 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -10,6 +10,7 @@ from typing import ( Callable, Dict, Generic, + Iterable, List, Mapping, Optional, @@ -125,7 +126,7 @@ _ScreenUnits = Union[str, float] # manual page: Tk_GetPixels _XYScrollCommand = Union[str, Callable[[float, float], Any]] # -xscrollcommand and -yscrollcommand in 'options' manual page _TakeFocusValue = Union[int, Literal[""], Callable[[str], Optional[bool]]] # -takefocus in manual page named 'options' -_ObjectId = NewType("ObjectId", int) +_CanvasObjectId = NewType("_CanvasObjectId", int) class EventType(str, Enum): Activate: str = ... @@ -1115,10 +1116,10 @@ class Canvas(Widget, XView, YView): def canvasx(self, screenx, gridspacing: Optional[Any] = ...): ... def canvasy(self, screeny, gridspacing: Optional[Any] = ...): ... def coords(self, *args): ... - def create_arc(self, *args, **kw) -> _ObjectId: ... - def create_bitmap(self, *args, **kw) -> _ObjectId: ... - def create_image(self, *args, **kw) -> _ObjectId: ... - def create_line(self, x0: int, y0: int, x1: int, y1: int, /, + def create_arc(self, *args, **kw) -> _CanvasObjectId: ... + def create_bitmap(self, *args, **kw) -> _CanvasObjectId: ... + def create_image(self, *args, **kw) -> _CanvasObjectId: ... + def create_line(self, __x0: int, __y0: int, __x1: int, __y1: int, activedash: _Color = ..., activefill: _Color = ..., activestipple: str = ..., @@ -1141,8 +1142,8 @@ class Canvas(Widget, XView, YView): stipple: _Bitmap = ..., tags: Union[str, Tuple[str, ...]] = ..., width: Union[int, str] = ..., - ) -> _ObjectId: ... - def create_oval(self, x0: int, y0: int, x1: int, y1: int, /, + ) -> _CanvasObjectId: ... + def create_oval(self, __x0: int, __y0: int, __x1: int, __y1: int, activedash: _Color = ..., activefill: _Color = ..., activeoutline: _Color = ..., @@ -1166,8 +1167,8 @@ class Canvas(Widget, XView, YView): stipple: _Bitmap = ..., tags: Union[str, Tuple[str, ...]] = ..., width: Union[int, str] = ..., - ) -> _ObjectId: ... - def create_polygon(self, x0: int, y0: int, x1: int, y1: int, *args: int, /, + ) -> _CanvasObjectId: ... + def create_polygon(self, __x0: int, __y0: int, __x1: int, __y1: int, *args: int, activedash: _Color = ..., activefill: _Color = ..., activeoutline: _Color = ..., @@ -1194,8 +1195,8 @@ class Canvas(Widget, XView, YView): stipple: _Bitmap = ..., tags: Union[str, Tuple[str, ...]] = ..., width: Union[int, str] = ..., - ) -> _ObjectId: ... - def create_rectangle(self, x0: int, y0: int, x1: int, y1: int, /, + ) -> _CanvasObjectId: ... + def create_rectangle(self, __x0: int, __y0: int, __x1: int, __y1: int, activedash: _Color = ..., activefill: _Color = ..., activeoutline: _Color = ..., @@ -1219,8 +1220,8 @@ class Canvas(Widget, XView, YView): stipple: _Bitmap = ..., tags: Union[str, Tuple[str, ...]] = ..., width: Union[int, str] = ..., - ) -> _ObjectId: ... - def create_text(self, x: int, y: int, / + ) -> _CanvasObjectId: ... + def create_text(self, __x: int, __y: int, activefill: _Color = ..., activestipple: str = ..., anchor: _Anchor = ..., @@ -1235,17 +1236,17 @@ class Canvas(Widget, XView, YView): tags: Union[str, Tuple[str, ...]] = ..., text: str = ..., width: Union[int, str] = ..., - ) -> _ObjectId: ... - def create_window(self, x: int, y: int, /, + ) -> _CanvasObjectId: ... + def create_window(self, __x: int, __y: int, anchor: _Anchor = ..., height: Union[int, str] = ..., state: Literal["normal", "active", "disabled"] = ..., tags: Union[str, Tuple[str, ...]] = ..., width: Union[int, str] = ..., window: Widget = ..., - ) -> _ObjectId: ... + ) -> _CanvasObjectId: ... def dchars(self, *args): ... - def delete(self, *args: Union[_ObjectId, typing.Iterable[_ObjectId]]) -> None: ... + def delete(self, *args: Union[_CanvasObjectId, Iterable[_CanvasObjectId]]) -> None: ... def dtag(self, *args): ... def find(self, *args): ... def find_above(self, tagOrId): ... From dce09b5a828f908850b95b2aececaea46119449f Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 9 Apr 2021 18:56:32 -0700 Subject: [PATCH 03/15] Tuple. --- stdlib/tkinter/__init__.pyi | 218 ++++++++++++++++++------------------ 1 file changed, 109 insertions(+), 109 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index ba15c3ca26ea..c2d3881ebe22 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -99,8 +99,8 @@ EXCEPTION = _tkinter.EXCEPTION # ... # _tkinter.TclError: unknown font style "deque(['bold'])" _T = TypeVar("_T") -_TkinterSequence = Union[List[_T], Tuple[_T, ...]] -_TkinterSequence2D = Union[List[List[_T]], List[Tuple[_T, ...]], Tuple[List[_T], ...], Tuple[Tuple[_T, ...], ...]] +_TkinterSequence = Union[List[_T], tuple[_T, ...]] +_TkinterSequence2D = Union[List[List[_T]], List[tuple[_T, ...]], tuple[List[_T], ...], tuple[tuple[_T, ...], ...]] # Some widgets have an option named -compound that accepts different values # than the _Compound defined here. Many other options have similar things. @@ -109,17 +109,17 @@ _Bitmap = str # manual page: Tk_GetBitmap _ButtonCommand = Union[str, Callable[[], Any]] # return value is returned from Button.invoke() _Color = str # typically '#rrggbb', '#rgb' or color names. _Compound = Literal["top", "left", "center", "right", "bottom", "none"] # -compound in manual page named 'options' -_Cursor = Union[str, Tuple[str], Tuple[str, str], Tuple[str, str, str], Tuple[str, str, str, str]] # manual page: Tk_GetCursor +_Cursor = Union[str, tuple[str], tuple[str, str], tuple[str, str, str], tuple[str, str, str, str]] # manual page: Tk_GetCursor _EntryValidateCommand = Union[ Callable[[], bool], str, _TkinterSequence[str] ] # example when it's sequence: entry['invalidcommand'] = [entry.register(print), '%P'] _ImageSpec = Union[_Image, str] # str can be from e.g. tkinter.image_names() _Padding = Union[ _ScreenUnits, - Tuple[_ScreenUnits], - Tuple[_ScreenUnits, _ScreenUnits], - Tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits], - Tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits], + tuple[_ScreenUnits], + tuple[_ScreenUnits, _ScreenUnits], + tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits], + tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits], ] _Relief = Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] # manual page: Tk_GetRelief _ScreenUnits = Union[str, float] # manual page: Tk_GetPixels @@ -202,7 +202,7 @@ class Variable: def get(self) -> Any: ... def trace_add(self, mode: _TraceMode, callback: Callable[[str, str, str], Any]) -> str: ... def trace_remove(self, mode: _TraceMode, cbname: str) -> None: ... - def trace_info(self) -> List[Tuple[Tuple[_TraceMode, ...], str]]: ... + def trace_info(self) -> List[tuple[tuple[_TraceMode, ...], str]]: ... def trace_variable(self, mode, callback): ... # deprecated def trace_vdelete(self, mode, cbname): ... # deprecated def trace_vinfo(self): ... # deprecated @@ -308,7 +308,7 @@ class Misc: def winfo_geometry(self) -> str: ... def winfo_height(self) -> int: ... def winfo_id(self) -> int: ... - def winfo_interps(self, displayof: Union[Literal[0], Misc, None] = ...) -> Tuple[str, ...]: ... + def winfo_interps(self, displayof: Union[Literal[0], Misc, None] = ...) -> tuple[str, ...]: ... def winfo_ismapped(self) -> bool: ... def winfo_manager(self) -> str: ... def winfo_name(self) -> str: ... @@ -316,11 +316,11 @@ class Misc: def winfo_pathname(self, id: int, displayof: Union[Literal[0], Misc, None] = ...): ... def winfo_pixels(self, number: _ScreenUnits) -> int: ... def winfo_pointerx(self) -> int: ... - def winfo_pointerxy(self) -> Tuple[int, int]: ... + def winfo_pointerxy(self) -> tuple[int, int]: ... def winfo_pointery(self) -> int: ... def winfo_reqheight(self) -> int: ... def winfo_reqwidth(self) -> int: ... - def winfo_rgb(self, color: _Color) -> Tuple[int, int, int]: ... + def winfo_rgb(self, color: _Color) -> tuple[int, int, int]: ... def winfo_rootx(self) -> int: ... def winfo_rooty(self) -> int: ... def winfo_screen(self) -> str: ... @@ -336,7 +336,7 @@ class Misc: def winfo_viewable(self) -> bool: ... def winfo_visual(self) -> str: ... def winfo_visualid(self) -> str: ... - def winfo_visualsavailable(self, includeids: int = ...) -> List[Tuple[str, int]]: ... + def winfo_visualsavailable(self, includeids: int = ...) -> List[tuple[str, int]]: ... def winfo_vrootheight(self) -> int: ... def winfo_vrootwidth(self) -> int: ... def winfo_vrootx(self) -> int: ... @@ -405,22 +405,22 @@ class Misc: @overload def grid_bbox( self, column: None = ..., row: None = ..., col2: None = ..., row2: None = ... - ) -> Optional[Tuple[int, int, int, int]]: ... + ) -> Optional[tuple[int, int, int, int]]: ... @overload - def grid_bbox(self, column: int, row: int, col2: None = ..., row2: None = ...) -> Optional[Tuple[int, int, int, int]]: ... + def grid_bbox(self, column: int, row: int, col2: None = ..., row2: None = ...) -> Optional[tuple[int, int, int, int]]: ... @overload - def grid_bbox(self, column: int, row: int, col2: int, row2: int) -> Optional[Tuple[int, int, int, int]]: ... + def grid_bbox(self, column: int, row: int, col2: int, row2: int) -> Optional[tuple[int, int, int, int]]: ... bbox = grid_bbox def grid_columnconfigure(self, index, cnf=..., **kw): ... # TODO def grid_rowconfigure(self, index, cnf=..., **kw): ... # TODO columnconfigure = grid_columnconfigure rowconfigure = grid_rowconfigure - def grid_location(self, x: _ScreenUnits, y: _ScreenUnits) -> Tuple[int, int]: ... + def grid_location(self, x: _ScreenUnits, y: _ScreenUnits) -> tuple[int, int]: ... @overload def grid_propagate(self, flag: bool) -> None: ... @overload def grid_propagate(self) -> bool: ... - def grid_size(self) -> Tuple[int, int]: ... + def grid_size(self) -> tuple[int, int]: ... size = grid_size # Widget because Toplevel or Tk is never a slave def pack_slaves(self) -> List[Widget]: ... @@ -461,9 +461,9 @@ class Misc: x: _ScreenUnits = ..., y: _ScreenUnits = ..., ) -> None: ... - def event_info(self, virtual: Optional[str] = ...) -> Tuple[str, ...]: ... - def image_names(self) -> Tuple[str, ...]: ... - def image_types(self) -> Tuple[str, ...]: ... + def event_info(self, virtual: Optional[str] = ...) -> tuple[str, ...]: ... + def image_names(self) -> tuple[str, ...]: ... + def image_types(self) -> tuple[str, ...]: ... # See #4363 and #4891 def __setitem__(self, key: str, value: Any) -> None: ... def __getitem__(self, key: str) -> Any: ... @@ -494,10 +494,10 @@ class Wm: @overload def wm_aspect( self, minNumer: None = ..., minDenom: None = ..., maxNumer: None = ..., maxDenom: None = ... - ) -> Optional[Tuple[int, int, int, int]]: ... + ) -> Optional[tuple[int, int, int, int]]: ... aspect = wm_aspect @overload - def wm_attributes(self) -> Tuple[Any, ...]: ... + def wm_attributes(self) -> tuple[Any, ...]: ... @overload def wm_attributes(self, __option: str) -> Any: ... @overload @@ -555,12 +555,12 @@ class Wm: def wm_manage(self, widget): ... manage = wm_manage @overload - def wm_maxsize(self, width: None = ..., height: None = ...) -> Tuple[int, int]: ... + def wm_maxsize(self, width: None = ..., height: None = ...) -> tuple[int, int]: ... @overload def wm_maxsize(self, width: int, height: int) -> None: ... maxsize = wm_maxsize @overload - def wm_minsize(self, width: None = ..., height: None = ...) -> Tuple[int, int]: ... + def wm_minsize(self, width: None = ..., height: None = ...) -> tuple[int, int]: ... @overload def wm_minsize(self, width: int, height: int) -> None: ... minsize = wm_minsize @@ -576,10 +576,10 @@ class Wm: @overload def wm_protocol(self, name: str, func: None = ...) -> str: ... @overload - def wm_protocol(self, name: None = ..., func: None = ...) -> Tuple[str, ...]: ... + def wm_protocol(self, name: None = ..., func: None = ...) -> tuple[str, ...]: ... protocol = wm_protocol @overload - def wm_resizable(self, width: None = ..., height: None = ...) -> Tuple[bool, bool]: ... + def wm_resizable(self, width: None = ..., height: None = ...) -> tuple[bool, bool]: ... @overload def wm_resizable(self, width: bool, height: bool) -> None: ... resizable = wm_resizable @@ -638,9 +638,9 @@ class Tk(Misc, Wm): relief: _Relief = ..., takefocus: _TakeFocusValue = ..., width: _ScreenUnits = ..., - ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure def loadtk(self) -> None: ... # differs from _tkinter.TkappType.loadtk def destroy(self) -> None: ... @@ -695,8 +695,8 @@ class _PackInfo(_InMiscTotal): # can be specified in pack(). ipadx: int ipady: int - padx: Union[int, Tuple[int, int]] - pady: Union[int, Tuple[int, int]] + padx: Union[int, tuple[int, int]] + pady: Union[int, tuple[int, int]] class Pack: # _PackInfo is not the valid type for cnf because pad stuff accepts any @@ -715,8 +715,8 @@ class Pack: side: Literal["left", "right", "top", "bottom"] = ..., ipadx: _ScreenUnits = ..., ipady: _ScreenUnits = ..., - padx: Union[_ScreenUnits, Tuple[_ScreenUnits, _ScreenUnits]] = ..., - pady: Union[_ScreenUnits, Tuple[_ScreenUnits, _ScreenUnits]] = ..., + padx: Union[_ScreenUnits, tuple[_ScreenUnits, _ScreenUnits]] = ..., + pady: Union[_ScreenUnits, tuple[_ScreenUnits, _ScreenUnits]] = ..., in_: Misc = ..., **kw: Any, # allow keyword argument named 'in', see #4836 ) -> None: ... @@ -784,8 +784,8 @@ class _GridInfo(_InMiscNonTotal): # empty dict if widget hasn't been gridded rowspan: int ipadx: int ipady: int - padx: Union[int, Tuple[int, int]] - pady: Union[int, Tuple[int, int]] + padx: Union[int, tuple[int, int]] + pady: Union[int, tuple[int, int]] sticky: str # consists of letters 'n', 's', 'w', 'e', no repeats, may be empty class Grid: @@ -799,8 +799,8 @@ class Grid: rowspan: int = ..., ipadx: _ScreenUnits = ..., ipady: _ScreenUnits = ..., - padx: Union[_ScreenUnits, Tuple[_ScreenUnits, _ScreenUnits]] = ..., - pady: Union[_ScreenUnits, Tuple[_ScreenUnits, _ScreenUnits]] = ..., + padx: Union[_ScreenUnits, tuple[_ScreenUnits, _ScreenUnits]] = ..., + pady: Union[_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 @@ -883,7 +883,7 @@ class Toplevel(BaseWidget, Wm): screen: str = ..., # can't be changed after creating widget takefocus: _TakeFocusValue = ..., use: int = ..., - visual: Union[str, Tuple[str, int]] = ..., + visual: Union[str, tuple[str, int]] = ..., width: _ScreenUnits = ..., ) -> None: ... @overload @@ -907,9 +907,9 @@ class Toplevel(BaseWidget, Wm): relief: _Relief = ..., takefocus: _TakeFocusValue = ..., width: _ScreenUnits = ..., - ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure class Button(Widget): @@ -1002,9 +1002,9 @@ class Button(Widget): underline: int = ..., width: _ScreenUnits = ..., wraplength: _ScreenUnits = ..., - ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure def flash(self): ... def invoke(self): ... @@ -1039,7 +1039,7 @@ class Canvas(Widget, XView, YView): relief: _Relief = ..., # Setting scrollregion to None doesn't reset it back to empty, # but setting it to () does. - scrollregion: Union[Tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits], Tuple[()]] = ..., + scrollregion: Union[tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits], tuple[()]] = ..., selectbackground: _Color = ..., selectborderwidth: _ScreenUnits = ..., selectforeground: _Color = ..., @@ -1076,7 +1076,7 @@ class Canvas(Widget, XView, YView): insertwidth: _ScreenUnits = ..., offset: Any = ..., # undocumented relief: _Relief = ..., - scrollregion: Union[Tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits], Tuple[()]] = ..., + scrollregion: Union[tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits], tuple[()]] = ..., selectbackground: _Color = ..., selectborderwidth: _ScreenUnits = ..., selectforeground: _Color = ..., @@ -1087,9 +1087,9 @@ class Canvas(Widget, XView, YView): xscrollincrement: _ScreenUnits = ..., yscrollcommand: _XYScrollCommand = ..., yscrollincrement: _ScreenUnits = ..., - ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure def addtag(self, *args): ... def addtag_above(self, newtag, tagOrId): ... @@ -1125,9 +1125,9 @@ class Canvas(Widget, XView, YView): activestipple: str = ..., activewidth: Union[int, str] = ..., arrow: Literal["first", "last", "both"] = ..., - arrowshape: Tuple[int, int, int] = ..., + arrowshape: tuple[int, int, int] = ..., capstyle: Literal["round", "projecting", "butt"] = ..., - dash: Union[Tuple[int], Tuple[int, int], Tuple[int, int, int, int]] = ..., + dash: Union[tuple[int], tuple[int, int], tuple[int, int, int, int]] = ..., dashoffset: Union[int, str] = ..., disableddash: _Color = ..., disabledfill: _Color = ..., @@ -1140,7 +1140,7 @@ class Canvas(Widget, XView, YView): splinesteps: int = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., - tags: Union[str, Tuple[str, ...]] = ..., + tags: Union[str, tuple[str, ...]] = ..., width: Union[int, str] = ..., ) -> _CanvasObjectId: ... def create_oval(self, __x0: int, __y0: int, __x1: int, __y1: int, @@ -1150,7 +1150,7 @@ class Canvas(Widget, XView, YView): activeoutlinestipple: _Color = ..., activestipple: str = ..., activewidth: Union[int, str] = ..., - dash: Union[Tuple[int], Tuple[int, int], Tuple[int, int, int, int]] = ..., + dash: Union[tuple[int], tuple[int, int], tuple[int, int, int, int]] = ..., dashoffset: Union[int, str] = ..., disableddash: _Color = ..., disabledfill: _Color = ..., @@ -1165,7 +1165,7 @@ class Canvas(Widget, XView, YView): outlinestipple: _Bitmap = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., - tags: Union[str, Tuple[str, ...]] = ..., + tags: Union[str, tuple[str, ...]] = ..., width: Union[int, str] = ..., ) -> _CanvasObjectId: ... def create_polygon(self, __x0: int, __y0: int, __x1: int, __y1: int, *args: int, @@ -1175,7 +1175,7 @@ class Canvas(Widget, XView, YView): activeoutlinestipple: _Color = ..., activestipple: str = ..., activewidth: Union[int, str] = ..., - dash: Union[Tuple[int], Tuple[int, int], Tuple[int, int, int, int]] = ..., + dash: Union[tuple[int], tuple[int, int], tuple[int, int, int, int]] = ..., dashoffset: Union[int, str] = ..., disableddash: _Color = ..., disabledfill: _Color = ..., @@ -1193,7 +1193,7 @@ class Canvas(Widget, XView, YView): splinesteps: int = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., - tags: Union[str, Tuple[str, ...]] = ..., + tags: Union[str, tuple[str, ...]] = ..., width: Union[int, str] = ..., ) -> _CanvasObjectId: ... def create_rectangle(self, __x0: int, __y0: int, __x1: int, __y1: int, @@ -1203,7 +1203,7 @@ class Canvas(Widget, XView, YView): activeoutlinestipple: _Color = ..., activestipple: str = ..., activewidth: Union[int, str] = ..., - dash: Union[Tuple[int], Tuple[int, int], Tuple[int, int, int, int]] = ..., + dash: Union[tuple[int], tuple[int, int], tuple[int, int, int, int]] = ..., dashoffset: Union[int, str] = ..., disableddash: _Color = ..., disabledfill: _Color = ..., @@ -1218,7 +1218,7 @@ class Canvas(Widget, XView, YView): outlinestipple: _Bitmap = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., - tags: Union[str, Tuple[str, ...]] = ..., + tags: Union[str, tuple[str, ...]] = ..., width: Union[int, str] = ..., ) -> _CanvasObjectId: ... def create_text(self, __x: int, __y: int, @@ -1233,7 +1233,7 @@ class Canvas(Widget, XView, YView): offset: Union[int, str] = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., - tags: Union[str, Tuple[str, ...]] = ..., + tags: Union[str, tuple[str, ...]] = ..., text: str = ..., width: Union[int, str] = ..., ) -> _CanvasObjectId: ... @@ -1241,7 +1241,7 @@ class Canvas(Widget, XView, YView): anchor: _Anchor = ..., height: Union[int, str] = ..., state: Literal["normal", "active", "disabled"] = ..., - tags: Union[str, Tuple[str, ...]] = ..., + tags: Union[str, tuple[str, ...]] = ..., width: Union[int, str] = ..., window: Widget = ..., ) -> _CanvasObjectId: ... @@ -1389,9 +1389,9 @@ class Checkbutton(Widget): variable: Union[Variable, Literal[""]] = ..., width: _ScreenUnits = ..., wraplength: _ScreenUnits = ..., - ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure def deselect(self): ... def flash(self): ... @@ -1486,9 +1486,9 @@ class Entry(Widget, XView): vcmd: _EntryValidateCommand = ..., width: int = ..., xscrollcommand: _XYScrollCommand = ..., - ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure def delete(self, first, last: Optional[Any] = ...): ... def get(self): ... @@ -1534,7 +1534,7 @@ class Frame(Widget): pady: _ScreenUnits = ..., relief: _Relief = ..., takefocus: _TakeFocusValue = ..., - visual: Union[str, Tuple[str, int]] = ..., + visual: Union[str, tuple[str, int]] = ..., width: _ScreenUnits = ..., ) -> None: ... @overload @@ -1557,9 +1557,9 @@ class Frame(Widget): relief: _Relief = ..., takefocus: _TakeFocusValue = ..., width: _ScreenUnits = ..., - ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure class Label(Widget): @@ -1637,9 +1637,9 @@ class Label(Widget): underline: int = ..., width: _ScreenUnits = ..., wraplength: _ScreenUnits = ..., - ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure class Listbox(Widget, XView, YView): @@ -1727,9 +1727,9 @@ class Listbox(Widget, XView, YView): width: int = ..., xscrollcommand: _XYScrollCommand = ..., yscrollcommand: _XYScrollCommand = ..., - ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure def activate(self, index): ... def bbox(self, index): ... @@ -1815,9 +1815,9 @@ class Menu(Widget): tearoffcommand: Union[Callable[[str, str], Any], str] = ..., title: str = ..., type: Literal["menubar", "tearoff", "normal"] = ..., - ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure def tk_popup(self, x: int, y: int, entry: _MenuIndex = ...): ... def activate(self, index): ... @@ -2106,9 +2106,9 @@ class Menubutton(Widget): underline: int = ..., width: _ScreenUnits = ..., wraplength: _ScreenUnits = ..., - ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure class Message(Widget): @@ -2169,9 +2169,9 @@ class Message(Widget): text: str = ..., textvariable: Variable = ..., width: _ScreenUnits = ..., - ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure class Radiobutton(Widget): @@ -2269,9 +2269,9 @@ class Radiobutton(Widget): variable: Union[Variable, Literal[""]] = ..., width: _ScreenUnits = ..., wraplength: _ScreenUnits = ..., - ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure def deselect(self): ... def flash(self): ... @@ -2360,9 +2360,9 @@ class Scale(Widget): troughcolor: _Color = ..., variable: Union[IntVar, DoubleVar] = ..., width: _ScreenUnits = ..., - ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure def get(self): ... def set(self, value): ... @@ -2386,7 +2386,7 @@ class Scrollbar(Widget): # '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: Union[Callable[..., Optional[Tuple[float, float]]], str] = ..., + command: Union[Callable[..., Optional[tuple[float, float]]], str] = ..., cursor: _Cursor = ..., elementborderwidth: _ScreenUnits = ..., highlightbackground: _Color = ..., @@ -2414,7 +2414,7 @@ class Scrollbar(Widget): bg: _Color = ..., border: _ScreenUnits = ..., borderwidth: _ScreenUnits = ..., - command: Union[Callable[..., Optional[Tuple[float, float]]], str] = ..., + command: Union[Callable[..., Optional[tuple[float, float]]], str] = ..., cursor: _Cursor = ..., elementborderwidth: _ScreenUnits = ..., highlightbackground: _Color = ..., @@ -2428,9 +2428,9 @@ class Scrollbar(Widget): takefocus: _TakeFocusValue = ..., troughcolor: _Color = ..., width: _ScreenUnits = ..., - ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure def activate(self, index: Optional[Any] = ...): ... def delta(self, deltax, deltay): ... @@ -2489,7 +2489,7 @@ class Text(Widget, XView, YView): startline: Union[int, Literal[""]] = ..., state: Literal["normal", "disabled"] = ..., # Literal inside Tuple doesn't actually work - tabs: Union[_ScreenUnits, str, Tuple[Union[_ScreenUnits, str], ...]] = ..., + tabs: Union[_ScreenUnits, str, tuple[Union[_ScreenUnits, str], ...]] = ..., tabstyle: Literal["tabular", "wordprocessor"] = ..., takefocus: _TakeFocusValue = ..., undo: bool = ..., @@ -2540,7 +2540,7 @@ class Text(Widget, XView, YView): spacing3: _ScreenUnits = ..., startline: Union[int, Literal[""]] = ..., state: Literal["normal", "disabled"] = ..., - tabs: Union[_ScreenUnits, str, Tuple[Union[_ScreenUnits, str], ...]] = ..., + tabs: Union[_ScreenUnits, str, tuple[Union[_ScreenUnits, str], ...]] = ..., tabstyle: Literal["tabular", "wordprocessor"] = ..., takefocus: _TakeFocusValue = ..., undo: bool = ..., @@ -2548,11 +2548,11 @@ class Text(Widget, XView, YView): wrap: Literal["none", "char", "word"] = ..., xscrollcommand: _XYScrollCommand = ..., yscrollcommand: _XYScrollCommand = ..., - ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure - def bbox(self, index: _TextIndex) -> Optional[Tuple[int, int, int, int]]: ... # type: ignore + def bbox(self, index: _TextIndex) -> Optional[tuple[int, int, int, int]]: ... # type: ignore def compare(self, index1: _TextIndex, op: Literal["<", "<=", "==", ">=", ">", "!="], index2: _TextIndex) -> bool: ... def count(self, index1, index2, *args): ... # TODO @overload @@ -2560,7 +2560,7 @@ class Text(Widget, XView, YView): @overload def debug(self, boolean: bool) -> None: ... def delete(self, index1: _TextIndex, index2: Optional[_TextIndex] = ...) -> None: ... - def dlineinfo(self, index: _TextIndex) -> Optional[Tuple[int, int, int, int, int]]: ... + def dlineinfo(self, index: _TextIndex) -> Optional[tuple[int, int, int, int, int]]: ... @overload def dump( self, @@ -2574,7 +2574,7 @@ class Text(Widget, XView, YView): tag: bool = ..., text: bool = ..., window: bool = ..., - ) -> List[Tuple[str, str, str]]: ... + ) -> List[tuple[str, str, str]]: ... @overload def dump( self, @@ -2624,14 +2624,14 @@ class Text(Widget, XView, YView): def mark_gravity(self, markName: str, direction: None = ...) -> Literal["left", "right"]: ... @overload def mark_gravity(self, markName: str, direction: Literal["left", "right"]) -> None: ... # actually returns empty string - def mark_names(self) -> Tuple[str, ...]: ... + def mark_names(self) -> tuple[str, ...]: ... def mark_set(self, markName: str, index: _TextIndex) -> None: ... def mark_unset(self, *markNames: str) -> None: ... def mark_next(self, index: _TextIndex) -> Optional[str]: ... def mark_previous(self, index: _TextIndex) -> Optional[str]: ... # **kw of peer_create is same as the kwargs of Text.__init__ def peer_create(self, newPathName: Union[str, Text], cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... - def peer_names(self) -> Tuple[_tkinter.Tcl_Obj, ...]: ... + def peer_names(self) -> tuple[_tkinter.Tcl_Obj, ...]: ... def replace(self, index1: _TextIndex, index2: _TextIndex, chars: str, *args: Union[str, _TkinterSequence[str]]) -> None: ... def scan_mark(self, x: int, y: int) -> None: ... def scan_dragto(self, x: int, y: int) -> None: ... @@ -2698,21 +2698,21 @@ class Text(Widget, XView, YView): underline: bool = ..., underlinefg: _Color = ..., wrap: Literal["none", "char", "word"] = ..., # be careful with "none" vs None - ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... @overload - def tag_configure(self, tagName: str, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def tag_configure(self, tagName: str, cnf: str) -> tuple[str, str, str, Any, Any]: ... tag_config = tag_configure def tag_delete(self, __first_tag_name: str, *tagNames: str) -> None: ... # error if no tag names given def tag_lower(self, tagName: str, belowThis: Optional[str] = ...) -> None: ... - def tag_names(self, index: Optional[_TextIndex] = ...) -> Tuple[str, ...]: ... + def tag_names(self, index: Optional[_TextIndex] = ...) -> tuple[str, ...]: ... def tag_nextrange( self, tagName: str, index1: _TextIndex, index2: Optional[_TextIndex] = ... - ) -> Union[Tuple[str, str], Tuple[()]]: ... + ) -> Union[tuple[str, str], tuple[()]]: ... def tag_prevrange( self, tagName: str, index1: _TextIndex, index2: Optional[_TextIndex] = ... - ) -> Union[Tuple[str, str], Tuple[()]]: ... + ) -> Union[tuple[str, str], tuple[()]]: ... def tag_raise(self, tagName: str, aboveThis: Optional[str] = ...) -> None: ... - def tag_ranges(self, tagName: str) -> Tuple[_tkinter.Tcl_Obj, ...]: ... + def tag_ranges(self, tagName: str) -> tuple[_tkinter.Tcl_Obj, ...]: ... # tag_remove and tag_delete are different def tag_remove(self, tagName: str, index1: _TextIndex, index2: Optional[_TextIndex] = ...) -> None: ... # TODO: window_* methods @@ -2797,11 +2797,11 @@ class PhotoImage(Image): def copy(self) -> PhotoImage: ... def zoom(self, x: int, y: Union[int, Literal[""]] = ...) -> PhotoImage: ... def subsample(self, x: int, y: Union[int, Literal[""]] = ...) -> PhotoImage: ... - def get(self, x: int, y: int) -> Tuple[int, int, int]: ... + def get(self, x: int, y: int) -> tuple[int, int, int]: ... def put( - self, data: Union[str, _TkinterSequence[str], _TkinterSequence2D[_Color]], to: Optional[Tuple[int, int]] = ... + self, data: Union[str, _TkinterSequence[str], _TkinterSequence2D[_Color]], to: Optional[tuple[int, int]] = ... ) -> None: ... - def write(self, filename: AnyPath, format: Optional[str] = ..., from_coords: Optional[Tuple[int, int]] = ...) -> None: ... + def write(self, filename: AnyPath, format: Optional[str] = ..., from_coords: Optional[tuple[int, int]] = ...) -> None: ... if sys.version_info >= (3, 8): def transparency_get(self, x: int, y: int) -> bool: ... def transparency_set(self, x: int, y: int, boolean: bool) -> None: ... @@ -2821,8 +2821,8 @@ class BitmapImage(Image): maskfile: AnyPath = ..., ) -> None: ... -def image_names() -> Tuple[str, ...]: ... -def image_types() -> Tuple[str, ...]: ... +def image_names() -> tuple[str, ...]: ... +def image_types() -> tuple[str, ...]: ... class Spinbox(Widget, XView): def __init__( @@ -2938,9 +2938,9 @@ class Spinbox(Widget, XView): width: int = ..., wrap: bool = ..., xscrollcommand: _XYScrollCommand = ..., - ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure def bbox(self, index): ... def delete(self, first, last: Optional[Any] = ...): ... @@ -2953,7 +2953,7 @@ class Spinbox(Widget, XView): def scan(self, *args): ... def scan_mark(self, x): ... def scan_dragto(self, x): ... - def selection(self, *args: Any) -> Tuple[int, ...]: ... + def selection(self, *args: Any) -> tuple[int, ...]: ... def selection_adjust(self, index): ... def selection_clear(self): ... def selection_element(self, element: Optional[Any] = ...): ... @@ -2994,7 +2994,7 @@ class LabelFrame(Widget): relief: _Relief = ..., takefocus: _TakeFocusValue = ..., text: str = ..., - visual: Union[str, Tuple[str, int]] = ..., + visual: Union[str, tuple[str, int]] = ..., width: _ScreenUnits = ..., ) -> None: ... @overload @@ -3023,9 +3023,9 @@ class LabelFrame(Widget): takefocus: _TakeFocusValue = ..., text: str = ..., width: _ScreenUnits = ..., - ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure class PanedWindow(Widget): @@ -3083,9 +3083,9 @@ class PanedWindow(Widget): sashwidth: _ScreenUnits = ..., showhandle: bool = ..., width: _ScreenUnits = ..., - ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure def add(self, child, **kw): ... def remove(self, child): ... From a5664523cd7c531f470b67a5c77ea2f243fe3e6b Mon Sep 17 00:00:00 2001 From: Akuli Date: Sat, 10 Apr 2021 11:04:06 +0300 Subject: [PATCH 04/15] black --- stdlib/tkinter/__init__.pyi | 75 +++++++++++++++++++++++++------------ 1 file changed, 51 insertions(+), 24 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index c2d3881ebe22..a3c811186e78 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -1119,7 +1119,12 @@ class Canvas(Widget, XView, YView): def create_arc(self, *args, **kw) -> _CanvasObjectId: ... def create_bitmap(self, *args, **kw) -> _CanvasObjectId: ... def create_image(self, *args, **kw) -> _CanvasObjectId: ... - def create_line(self, __x0: int, __y0: int, __x1: int, __y1: int, + def create_line( + self, + __x0: int, + __y0: int, + __x1: int, + __y1: int, activedash: _Color = ..., activefill: _Color = ..., activestipple: str = ..., @@ -1132,18 +1137,23 @@ class Canvas(Widget, XView, YView): disableddash: _Color = ..., disabledfill: _Color = ..., disabledstipple: _Bitmap = ..., - disabledwidth: Union[int, str] = ..., + disabledwidth: Union[int, str] = ..., fill: _Color = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: Union[int, str] = ..., + offset: Union[int, str] = ..., smooth: Literal[0, 1] = ..., splinesteps: int = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., tags: Union[str, tuple[str, ...]] = ..., - width: Union[int, str] = ..., + width: Union[int, str] = ..., ) -> _CanvasObjectId: ... - def create_oval(self, __x0: int, __y0: int, __x1: int, __y1: int, + def create_oval( + self, + __x0: int, + __y0: int, + __x1: int, + __y1: int, activedash: _Color = ..., activefill: _Color = ..., activeoutline: _Color = ..., @@ -1157,18 +1167,24 @@ class Canvas(Widget, XView, YView): disabledoutline: _Color = ..., disabledoutlinestipple: _Color = ..., disabledstipple: _Bitmap = ..., - disabledwidth: Union[int, str] = ..., + disabledwidth: Union[int, str] = ..., fill: _Color = ..., - offset: Union[int, str] = ..., + offset: Union[int, str] = ..., outline: _Color = ..., - outlineoffset: Union[int, str] = ..., + outlineoffset: Union[int, str] = ..., outlinestipple: _Bitmap = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., tags: Union[str, tuple[str, ...]] = ..., - width: Union[int, str] = ..., + width: Union[int, str] = ..., ) -> _CanvasObjectId: ... - def create_polygon(self, __x0: int, __y0: int, __x1: int, __y1: int, *args: int, + def create_polygon( + self, + __x0: int, + __y0: int, + __x1: int, + __y1: int, + *args: int, activedash: _Color = ..., activefill: _Color = ..., activeoutline: _Color = ..., @@ -1182,21 +1198,26 @@ class Canvas(Widget, XView, YView): disabledoutline: _Color = ..., disabledoutlinestipple: _Color = ..., disabledstipple: _Bitmap = ..., - disabledwidth: Union[int, str] = ..., + disabledwidth: Union[int, str] = ..., fill: _Color = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: Union[int, str] = ..., + offset: Union[int, str] = ..., outline: _Color = ..., - outlineoffset: Union[int, str] = ..., + outlineoffset: Union[int, str] = ..., outlinestipple: _Bitmap = ..., smooth: Literal[0, 1] = ..., splinesteps: int = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., tags: Union[str, tuple[str, ...]] = ..., - width: Union[int, str] = ..., + width: Union[int, str] = ..., ) -> _CanvasObjectId: ... - def create_rectangle(self, __x0: int, __y0: int, __x1: int, __y1: int, + def create_rectangle( + self, + __x0: int, + __y0: int, + __x1: int, + __y1: int, activedash: _Color = ..., activefill: _Color = ..., activeoutline: _Color = ..., @@ -1210,18 +1231,21 @@ class Canvas(Widget, XView, YView): disabledoutline: _Color = ..., disabledoutlinestipple: _Color = ..., disabledstipple: _Bitmap = ..., - disabledwidth: Union[int, str] = ..., + disabledwidth: Union[int, str] = ..., fill: _Color = ..., - offset: Union[int, str] = ..., + offset: Union[int, str] = ..., outline: _Color = ..., - outlineoffset: Union[int, str] = ..., + outlineoffset: Union[int, str] = ..., outlinestipple: _Bitmap = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., tags: Union[str, tuple[str, ...]] = ..., - width: Union[int, str] = ..., + width: Union[int, str] = ..., ) -> _CanvasObjectId: ... - def create_text(self, __x: int, __y: int, + def create_text( + self, + __x: int, + __y: int, activefill: _Color = ..., activestipple: str = ..., anchor: _Anchor = ..., @@ -1230,19 +1254,22 @@ class Canvas(Widget, XView, YView): fill: _Color = ..., font: _FontDescription = ..., justify: Literal["left", "center", "right"] = ..., - offset: Union[int, str] = ..., + offset: Union[int, str] = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., tags: Union[str, tuple[str, ...]] = ..., text: str = ..., - width: Union[int, str] = ..., + width: Union[int, str] = ..., ) -> _CanvasObjectId: ... - def create_window(self, __x: int, __y: int, + def create_window( + self, + __x: int, + __y: int, anchor: _Anchor = ..., height: Union[int, str] = ..., state: Literal["normal", "active", "disabled"] = ..., tags: Union[str, tuple[str, ...]] = ..., - width: Union[int, str] = ..., + width: Union[int, str] = ..., window: Widget = ..., ) -> _CanvasObjectId: ... def dchars(self, *args): ... From 5d2c6fefc933633baed6577107d9c756f696b3be Mon Sep 17 00:00:00 2001 From: Akuli Date: Sat, 10 Apr 2021 11:05:42 +0300 Subject: [PATCH 05/15] isort --- stdlib/tkinter/__init__.pyi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index a3c811186e78..8507fb9b6822 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -22,8 +22,7 @@ from typing import ( Union, overload, ) - -from typing_extensions import Literal, TypedDict, NewType +from typing_extensions import Literal, NewType, TypedDict # Using anything from tkinter.font in this file means that 'import tkinter' # seems to also load tkinter.font. That's not how it actually works, but From 7c2a0ccf2b5758ec7ed676758a3f11077dfdfdb7 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Sat, 10 Apr 2021 13:33:06 -0700 Subject: [PATCH 06/15] Add separator between positional-or-keyword args and keyword-only args. --- stdlib/tkinter/__init__.pyi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 8507fb9b6822..05198d9f53c1 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -1124,6 +1124,7 @@ class Canvas(Widget, XView, YView): __y0: int, __x1: int, __y1: int, + *, activedash: _Color = ..., activefill: _Color = ..., activestipple: str = ..., @@ -1153,6 +1154,7 @@ class Canvas(Widget, XView, YView): __y0: int, __x1: int, __y1: int, + *, activedash: _Color = ..., activefill: _Color = ..., activeoutline: _Color = ..., @@ -1217,6 +1219,7 @@ class Canvas(Widget, XView, YView): __y0: int, __x1: int, __y1: int, + *, activedash: _Color = ..., activefill: _Color = ..., activeoutline: _Color = ..., @@ -1245,6 +1248,7 @@ class Canvas(Widget, XView, YView): self, __x: int, __y: int, + *, activefill: _Color = ..., activestipple: str = ..., anchor: _Anchor = ..., @@ -1264,6 +1268,7 @@ class Canvas(Widget, XView, YView): self, __x: int, __y: int, + *, anchor: _Anchor = ..., height: Union[int, str] = ..., state: Literal["normal", "active", "disabled"] = ..., From 7ff335157b78cb73f8b87cd24b2a108280b9125c Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Sat, 10 Apr 2021 13:34:50 -0700 Subject: [PATCH 07/15] int to float --- stdlib/tkinter/__init__.pyi | 110 ++++++++++++++++++------------------ 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 05198d9f53c1..8f33e6042352 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -1120,134 +1120,134 @@ class Canvas(Widget, XView, YView): def create_image(self, *args, **kw) -> _CanvasObjectId: ... def create_line( self, - __x0: int, - __y0: int, - __x1: int, - __y1: int, + __x0: float, + __y0: float, + __x1: float, + __y1: float, *, activedash: _Color = ..., activefill: _Color = ..., activestipple: str = ..., - activewidth: Union[int, str] = ..., + activewidth: Union[float, str] = ..., arrow: Literal["first", "last", "both"] = ..., - arrowshape: tuple[int, int, int] = ..., + arrowshape: tuple[float, float, float] = ..., capstyle: Literal["round", "projecting", "butt"] = ..., - dash: Union[tuple[int], tuple[int, int], tuple[int, int, int, int]] = ..., - dashoffset: Union[int, str] = ..., + dash: Union[tuple[float], tuple[float, float], tuple[float, float, float, float]] = ..., + dashoffset: Union[float, str] = ..., disableddash: _Color = ..., disabledfill: _Color = ..., disabledstipple: _Bitmap = ..., - disabledwidth: Union[int, str] = ..., + disabledwidth: Union[float, str] = ..., fill: _Color = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: Union[int, str] = ..., + offset: Union[float, str] = ..., smooth: Literal[0, 1] = ..., - splinesteps: int = ..., + splinesteps: float = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., tags: Union[str, tuple[str, ...]] = ..., - width: Union[int, str] = ..., + width: Union[float, str] = ..., ) -> _CanvasObjectId: ... def create_oval( self, - __x0: int, - __y0: int, - __x1: int, - __y1: int, + __x0: float, + __y0: float, + __x1: float, + __y1: float, *, activedash: _Color = ..., activefill: _Color = ..., activeoutline: _Color = ..., activeoutlinestipple: _Color = ..., activestipple: str = ..., - activewidth: Union[int, str] = ..., - dash: Union[tuple[int], tuple[int, int], tuple[int, int, int, int]] = ..., - dashoffset: Union[int, str] = ..., + activewidth: Union[float, str] = ..., + dash: Union[tuple[float], tuple[float, float], tuple[float, float, float, float]] = ..., + dashoffset: Union[float, str] = ..., disableddash: _Color = ..., disabledfill: _Color = ..., disabledoutline: _Color = ..., disabledoutlinestipple: _Color = ..., disabledstipple: _Bitmap = ..., - disabledwidth: Union[int, str] = ..., + disabledwidth: Union[float, str] = ..., fill: _Color = ..., - offset: Union[int, str] = ..., + offset: Union[float, str] = ..., outline: _Color = ..., - outlineoffset: Union[int, str] = ..., + outlineoffset: Union[float, str] = ..., outlinestipple: _Bitmap = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., tags: Union[str, tuple[str, ...]] = ..., - width: Union[int, str] = ..., + width: Union[float, str] = ..., ) -> _CanvasObjectId: ... def create_polygon( self, - __x0: int, - __y0: int, - __x1: int, - __y1: int, - *args: int, + __x0: float, + __y0: float, + __x1: float, + __y1: float, + *args: float, activedash: _Color = ..., activefill: _Color = ..., activeoutline: _Color = ..., activeoutlinestipple: _Color = ..., activestipple: str = ..., - activewidth: Union[int, str] = ..., - dash: Union[tuple[int], tuple[int, int], tuple[int, int, int, int]] = ..., - dashoffset: Union[int, str] = ..., + activewidth: Union[float, str] = ..., + dash: Union[tuple[float], tuple[float, float], tuple[float, float, float, float]] = ..., + dashoffset: Union[float, str] = ..., disableddash: _Color = ..., disabledfill: _Color = ..., disabledoutline: _Color = ..., disabledoutlinestipple: _Color = ..., disabledstipple: _Bitmap = ..., - disabledwidth: Union[int, str] = ..., + disabledwidth: Union[float, str] = ..., fill: _Color = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: Union[int, str] = ..., + offset: Union[float, str] = ..., outline: _Color = ..., - outlineoffset: Union[int, str] = ..., + outlineoffset: Union[float, str] = ..., outlinestipple: _Bitmap = ..., smooth: Literal[0, 1] = ..., - splinesteps: int = ..., + splinesteps: float = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., tags: Union[str, tuple[str, ...]] = ..., - width: Union[int, str] = ..., + width: Union[float, str] = ..., ) -> _CanvasObjectId: ... def create_rectangle( self, - __x0: int, - __y0: int, - __x1: int, - __y1: int, + __x0: float, + __y0: float, + __x1: float, + __y1: float, *, activedash: _Color = ..., activefill: _Color = ..., activeoutline: _Color = ..., activeoutlinestipple: _Color = ..., activestipple: str = ..., - activewidth: Union[int, str] = ..., - dash: Union[tuple[int], tuple[int, int], tuple[int, int, int, int]] = ..., - dashoffset: Union[int, str] = ..., + activewidth: Union[float, str] = ..., + dash: Union[tuple[float], tuple[float, float], tuple[float, float, float, float]] = ..., + dashoffset: Union[float, str] = ..., disableddash: _Color = ..., disabledfill: _Color = ..., disabledoutline: _Color = ..., disabledoutlinestipple: _Color = ..., disabledstipple: _Bitmap = ..., - disabledwidth: Union[int, str] = ..., + disabledwidth: Union[float, str] = ..., fill: _Color = ..., - offset: Union[int, str] = ..., + offset: Union[float, str] = ..., outline: _Color = ..., - outlineoffset: Union[int, str] = ..., + outlineoffset: Union[float, str] = ..., outlinestipple: _Bitmap = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., tags: Union[str, tuple[str, ...]] = ..., - width: Union[int, str] = ..., + width: Union[float, str] = ..., ) -> _CanvasObjectId: ... def create_text( self, - __x: int, - __y: int, + __x: float, + __y: float, *, activefill: _Color = ..., activestipple: str = ..., @@ -1257,23 +1257,23 @@ class Canvas(Widget, XView, YView): fill: _Color = ..., font: _FontDescription = ..., justify: Literal["left", "center", "right"] = ..., - offset: Union[int, str] = ..., + offset: Union[float, str] = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., tags: Union[str, tuple[str, ...]] = ..., text: str = ..., - width: Union[int, str] = ..., + width: Union[float, str] = ..., ) -> _CanvasObjectId: ... def create_window( self, - __x: int, - __y: int, + __x: float, + __y: float, *, anchor: _Anchor = ..., - height: Union[int, str] = ..., + height: Union[float, str] = ..., state: Literal["normal", "active", "disabled"] = ..., tags: Union[str, tuple[str, ...]] = ..., - width: Union[int, str] = ..., + width: Union[float, str] = ..., window: Widget = ..., ) -> _CanvasObjectId: ... def dchars(self, *args): ... From 1b781396f4f7882c642bd201e8918407d728abee Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Sat, 10 Apr 2021 18:39:40 -0700 Subject: [PATCH 08/15] Screen units. --- stdlib/tkinter/__init__.pyi | 54 ++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 8f33e6042352..8ab67096806c 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -1128,25 +1128,25 @@ class Canvas(Widget, XView, YView): activedash: _Color = ..., activefill: _Color = ..., activestipple: str = ..., - activewidth: Union[float, str] = ..., + activewidth: _ScreenUnits = ..., arrow: Literal["first", "last", "both"] = ..., arrowshape: tuple[float, float, float] = ..., capstyle: Literal["round", "projecting", "butt"] = ..., dash: Union[tuple[float], tuple[float, float], tuple[float, float, float, float]] = ..., - dashoffset: Union[float, str] = ..., + dashoffset: _ScreenUnits = ..., disableddash: _Color = ..., disabledfill: _Color = ..., disabledstipple: _Bitmap = ..., - disabledwidth: Union[float, str] = ..., + disabledwidth: _ScreenUnits = ..., fill: _Color = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: Union[float, str] = ..., + offset: _ScreenUnits = ..., smooth: Literal[0, 1] = ..., splinesteps: float = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., tags: Union[str, tuple[str, ...]] = ..., - width: Union[float, str] = ..., + width: _ScreenUnits = ..., ) -> _CanvasObjectId: ... def create_oval( self, @@ -1160,24 +1160,24 @@ class Canvas(Widget, XView, YView): activeoutline: _Color = ..., activeoutlinestipple: _Color = ..., activestipple: str = ..., - activewidth: Union[float, str] = ..., + activewidth: _ScreenUnits = ..., dash: Union[tuple[float], tuple[float, float], tuple[float, float, float, float]] = ..., - dashoffset: Union[float, str] = ..., + dashoffset: _ScreenUnits = ..., disableddash: _Color = ..., disabledfill: _Color = ..., disabledoutline: _Color = ..., disabledoutlinestipple: _Color = ..., disabledstipple: _Bitmap = ..., - disabledwidth: Union[float, str] = ..., + disabledwidth: _ScreenUnits = ..., fill: _Color = ..., - offset: Union[float, str] = ..., + offset: _ScreenUnits = ..., outline: _Color = ..., - outlineoffset: Union[float, str] = ..., + outlineoffset: _ScreenUnits = ..., outlinestipple: _Bitmap = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., tags: Union[str, tuple[str, ...]] = ..., - width: Union[float, str] = ..., + width: _ScreenUnits = ..., ) -> _CanvasObjectId: ... def create_polygon( self, @@ -1191,27 +1191,27 @@ class Canvas(Widget, XView, YView): activeoutline: _Color = ..., activeoutlinestipple: _Color = ..., activestipple: str = ..., - activewidth: Union[float, str] = ..., + activewidth: _ScreenUnits = ..., dash: Union[tuple[float], tuple[float, float], tuple[float, float, float, float]] = ..., - dashoffset: Union[float, str] = ..., + dashoffset: _ScreenUnits = ..., disableddash: _Color = ..., disabledfill: _Color = ..., disabledoutline: _Color = ..., disabledoutlinestipple: _Color = ..., disabledstipple: _Bitmap = ..., - disabledwidth: Union[float, str] = ..., + disabledwidth: _ScreenUnits = ..., fill: _Color = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., - offset: Union[float, str] = ..., + offset: _ScreenUnits = ..., outline: _Color = ..., - outlineoffset: Union[float, str] = ..., + outlineoffset: _ScreenUnits = ..., outlinestipple: _Bitmap = ..., smooth: Literal[0, 1] = ..., splinesteps: float = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., tags: Union[str, tuple[str, ...]] = ..., - width: Union[float, str] = ..., + width: _ScreenUnits = ..., ) -> _CanvasObjectId: ... def create_rectangle( self, @@ -1225,24 +1225,24 @@ class Canvas(Widget, XView, YView): activeoutline: _Color = ..., activeoutlinestipple: _Color = ..., activestipple: str = ..., - activewidth: Union[float, str] = ..., + activewidth: _ScreenUnits = ..., dash: Union[tuple[float], tuple[float, float], tuple[float, float, float, float]] = ..., - dashoffset: Union[float, str] = ..., + dashoffset: _ScreenUnits = ..., disableddash: _Color = ..., disabledfill: _Color = ..., disabledoutline: _Color = ..., disabledoutlinestipple: _Color = ..., disabledstipple: _Bitmap = ..., - disabledwidth: Union[float, str] = ..., + disabledwidth: _ScreenUnits = ..., fill: _Color = ..., - offset: Union[float, str] = ..., + offset: _ScreenUnits = ..., outline: _Color = ..., - outlineoffset: Union[float, str] = ..., + outlineoffset: _ScreenUnits = ..., outlinestipple: _Bitmap = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., tags: Union[str, tuple[str, ...]] = ..., - width: Union[float, str] = ..., + width: _ScreenUnits = ..., ) -> _CanvasObjectId: ... def create_text( self, @@ -1257,12 +1257,12 @@ class Canvas(Widget, XView, YView): fill: _Color = ..., font: _FontDescription = ..., justify: Literal["left", "center", "right"] = ..., - offset: Union[float, str] = ..., + offset: _ScreenUnits = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., tags: Union[str, tuple[str, ...]] = ..., text: str = ..., - width: Union[float, str] = ..., + width: _ScreenUnits = ..., ) -> _CanvasObjectId: ... def create_window( self, @@ -1270,10 +1270,10 @@ class Canvas(Widget, XView, YView): __y: float, *, anchor: _Anchor = ..., - height: Union[float, str] = ..., + height: _ScreenUnits = ..., state: Literal["normal", "active", "disabled"] = ..., tags: Union[str, tuple[str, ...]] = ..., - width: Union[float, str] = ..., + width: _ScreenUnits = ..., window: Widget = ..., ) -> _CanvasObjectId: ... def dchars(self, *args): ... From a1d5b99e27394d7ec89e37af3abe485ea8b3ae32 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Sat, 10 Apr 2021 18:40:04 -0700 Subject: [PATCH 09/15] Back to Tuple. --- stdlib/tkinter/__init__.pyi | 218 ++++++++++++++++++------------------ 1 file changed, 109 insertions(+), 109 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 8ab67096806c..8f3a5e96bb9e 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -98,8 +98,8 @@ EXCEPTION = _tkinter.EXCEPTION # ... # _tkinter.TclError: unknown font style "deque(['bold'])" _T = TypeVar("_T") -_TkinterSequence = Union[List[_T], tuple[_T, ...]] -_TkinterSequence2D = Union[List[List[_T]], List[tuple[_T, ...]], tuple[List[_T], ...], tuple[tuple[_T, ...], ...]] +_TkinterSequence = Union[List[_T], Tuple[_T, ...]] +_TkinterSequence2D = Union[List[List[_T]], List[Tuple[_T, ...]], Tuple[List[_T], ...], Tuple[Tuple[_T, ...], ...]] # Some widgets have an option named -compound that accepts different values # than the _Compound defined here. Many other options have similar things. @@ -108,17 +108,17 @@ _Bitmap = str # manual page: Tk_GetBitmap _ButtonCommand = Union[str, Callable[[], Any]] # return value is returned from Button.invoke() _Color = str # typically '#rrggbb', '#rgb' or color names. _Compound = Literal["top", "left", "center", "right", "bottom", "none"] # -compound in manual page named 'options' -_Cursor = Union[str, tuple[str], tuple[str, str], tuple[str, str, str], tuple[str, str, str, str]] # manual page: Tk_GetCursor +_Cursor = Union[str, Tuple[str], Tuple[str, str], Tuple[str, str, str], Tuple[str, str, str, str]] # manual page: Tk_GetCursor _EntryValidateCommand = Union[ Callable[[], bool], str, _TkinterSequence[str] ] # example when it's sequence: entry['invalidcommand'] = [entry.register(print), '%P'] _ImageSpec = Union[_Image, str] # str can be from e.g. tkinter.image_names() _Padding = Union[ _ScreenUnits, - tuple[_ScreenUnits], - tuple[_ScreenUnits, _ScreenUnits], - tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits], - tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits], + Tuple[_ScreenUnits], + Tuple[_ScreenUnits, _ScreenUnits], + Tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits], + Tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits], ] _Relief = Literal["raised", "sunken", "flat", "ridge", "solid", "groove"] # manual page: Tk_GetRelief _ScreenUnits = Union[str, float] # manual page: Tk_GetPixels @@ -201,7 +201,7 @@ class Variable: def get(self) -> Any: ... def trace_add(self, mode: _TraceMode, callback: Callable[[str, str, str], Any]) -> str: ... def trace_remove(self, mode: _TraceMode, cbname: str) -> None: ... - def trace_info(self) -> List[tuple[tuple[_TraceMode, ...], str]]: ... + def trace_info(self) -> List[Tuple[Tuple[_TraceMode, ...], str]]: ... def trace_variable(self, mode, callback): ... # deprecated def trace_vdelete(self, mode, cbname): ... # deprecated def trace_vinfo(self): ... # deprecated @@ -307,7 +307,7 @@ class Misc: def winfo_geometry(self) -> str: ... def winfo_height(self) -> int: ... def winfo_id(self) -> int: ... - def winfo_interps(self, displayof: Union[Literal[0], Misc, None] = ...) -> tuple[str, ...]: ... + def winfo_interps(self, displayof: Union[Literal[0], Misc, None] = ...) -> Tuple[str, ...]: ... def winfo_ismapped(self) -> bool: ... def winfo_manager(self) -> str: ... def winfo_name(self) -> str: ... @@ -315,11 +315,11 @@ class Misc: def winfo_pathname(self, id: int, displayof: Union[Literal[0], Misc, None] = ...): ... def winfo_pixels(self, number: _ScreenUnits) -> int: ... def winfo_pointerx(self) -> int: ... - def winfo_pointerxy(self) -> tuple[int, int]: ... + def winfo_pointerxy(self) -> Tuple[int, int]: ... def winfo_pointery(self) -> int: ... def winfo_reqheight(self) -> int: ... def winfo_reqwidth(self) -> int: ... - def winfo_rgb(self, color: _Color) -> tuple[int, int, int]: ... + def winfo_rgb(self, color: _Color) -> Tuple[int, int, int]: ... def winfo_rootx(self) -> int: ... def winfo_rooty(self) -> int: ... def winfo_screen(self) -> str: ... @@ -335,7 +335,7 @@ class Misc: def winfo_viewable(self) -> bool: ... def winfo_visual(self) -> str: ... def winfo_visualid(self) -> str: ... - def winfo_visualsavailable(self, includeids: int = ...) -> List[tuple[str, int]]: ... + def winfo_visualsavailable(self, includeids: int = ...) -> List[Tuple[str, int]]: ... def winfo_vrootheight(self) -> int: ... def winfo_vrootwidth(self) -> int: ... def winfo_vrootx(self) -> int: ... @@ -404,22 +404,22 @@ class Misc: @overload def grid_bbox( self, column: None = ..., row: None = ..., col2: None = ..., row2: None = ... - ) -> Optional[tuple[int, int, int, int]]: ... + ) -> Optional[Tuple[int, int, int, int]]: ... @overload - def grid_bbox(self, column: int, row: int, col2: None = ..., row2: None = ...) -> Optional[tuple[int, int, int, int]]: ... + def grid_bbox(self, column: int, row: int, col2: None = ..., row2: None = ...) -> Optional[Tuple[int, int, int, int]]: ... @overload - def grid_bbox(self, column: int, row: int, col2: int, row2: int) -> Optional[tuple[int, int, int, int]]: ... + def grid_bbox(self, column: int, row: int, col2: int, row2: int) -> Optional[Tuple[int, int, int, int]]: ... bbox = grid_bbox def grid_columnconfigure(self, index, cnf=..., **kw): ... # TODO def grid_rowconfigure(self, index, cnf=..., **kw): ... # TODO columnconfigure = grid_columnconfigure rowconfigure = grid_rowconfigure - def grid_location(self, x: _ScreenUnits, y: _ScreenUnits) -> tuple[int, int]: ... + def grid_location(self, x: _ScreenUnits, y: _ScreenUnits) -> Tuple[int, int]: ... @overload def grid_propagate(self, flag: bool) -> None: ... @overload def grid_propagate(self) -> bool: ... - def grid_size(self) -> tuple[int, int]: ... + def grid_size(self) -> Tuple[int, int]: ... size = grid_size # Widget because Toplevel or Tk is never a slave def pack_slaves(self) -> List[Widget]: ... @@ -460,9 +460,9 @@ class Misc: x: _ScreenUnits = ..., y: _ScreenUnits = ..., ) -> None: ... - def event_info(self, virtual: Optional[str] = ...) -> tuple[str, ...]: ... - def image_names(self) -> tuple[str, ...]: ... - def image_types(self) -> tuple[str, ...]: ... + def event_info(self, virtual: Optional[str] = ...) -> Tuple[str, ...]: ... + def image_names(self) -> Tuple[str, ...]: ... + def image_types(self) -> Tuple[str, ...]: ... # See #4363 and #4891 def __setitem__(self, key: str, value: Any) -> None: ... def __getitem__(self, key: str) -> Any: ... @@ -493,10 +493,10 @@ class Wm: @overload def wm_aspect( self, minNumer: None = ..., minDenom: None = ..., maxNumer: None = ..., maxDenom: None = ... - ) -> Optional[tuple[int, int, int, int]]: ... + ) -> Optional[Tuple[int, int, int, int]]: ... aspect = wm_aspect @overload - def wm_attributes(self) -> tuple[Any, ...]: ... + def wm_attributes(self) -> Tuple[Any, ...]: ... @overload def wm_attributes(self, __option: str) -> Any: ... @overload @@ -554,12 +554,12 @@ class Wm: def wm_manage(self, widget): ... manage = wm_manage @overload - def wm_maxsize(self, width: None = ..., height: None = ...) -> tuple[int, int]: ... + def wm_maxsize(self, width: None = ..., height: None = ...) -> Tuple[int, int]: ... @overload def wm_maxsize(self, width: int, height: int) -> None: ... maxsize = wm_maxsize @overload - def wm_minsize(self, width: None = ..., height: None = ...) -> tuple[int, int]: ... + def wm_minsize(self, width: None = ..., height: None = ...) -> Tuple[int, int]: ... @overload def wm_minsize(self, width: int, height: int) -> None: ... minsize = wm_minsize @@ -575,10 +575,10 @@ class Wm: @overload def wm_protocol(self, name: str, func: None = ...) -> str: ... @overload - def wm_protocol(self, name: None = ..., func: None = ...) -> tuple[str, ...]: ... + def wm_protocol(self, name: None = ..., func: None = ...) -> Tuple[str, ...]: ... protocol = wm_protocol @overload - def wm_resizable(self, width: None = ..., height: None = ...) -> tuple[bool, bool]: ... + def wm_resizable(self, width: None = ..., height: None = ...) -> Tuple[bool, bool]: ... @overload def wm_resizable(self, width: bool, height: bool) -> None: ... resizable = wm_resizable @@ -637,9 +637,9 @@ class Tk(Misc, Wm): relief: _Relief = ..., takefocus: _TakeFocusValue = ..., width: _ScreenUnits = ..., - ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure def loadtk(self) -> None: ... # differs from _tkinter.TkappType.loadtk def destroy(self) -> None: ... @@ -694,8 +694,8 @@ class _PackInfo(_InMiscTotal): # can be specified in pack(). ipadx: int ipady: int - padx: Union[int, tuple[int, int]] - pady: Union[int, tuple[int, int]] + padx: Union[int, Tuple[int, int]] + pady: Union[int, Tuple[int, int]] class Pack: # _PackInfo is not the valid type for cnf because pad stuff accepts any @@ -714,8 +714,8 @@ class Pack: side: Literal["left", "right", "top", "bottom"] = ..., ipadx: _ScreenUnits = ..., ipady: _ScreenUnits = ..., - padx: Union[_ScreenUnits, tuple[_ScreenUnits, _ScreenUnits]] = ..., - pady: Union[_ScreenUnits, tuple[_ScreenUnits, _ScreenUnits]] = ..., + padx: Union[_ScreenUnits, Tuple[_ScreenUnits, _ScreenUnits]] = ..., + pady: Union[_ScreenUnits, Tuple[_ScreenUnits, _ScreenUnits]] = ..., in_: Misc = ..., **kw: Any, # allow keyword argument named 'in', see #4836 ) -> None: ... @@ -783,8 +783,8 @@ class _GridInfo(_InMiscNonTotal): # empty dict if widget hasn't been gridded rowspan: int ipadx: int ipady: int - padx: Union[int, tuple[int, int]] - pady: Union[int, tuple[int, int]] + padx: Union[int, Tuple[int, int]] + pady: Union[int, Tuple[int, int]] sticky: str # consists of letters 'n', 's', 'w', 'e', no repeats, may be empty class Grid: @@ -798,8 +798,8 @@ class Grid: rowspan: int = ..., ipadx: _ScreenUnits = ..., ipady: _ScreenUnits = ..., - padx: Union[_ScreenUnits, tuple[_ScreenUnits, _ScreenUnits]] = ..., - pady: Union[_ScreenUnits, tuple[_ScreenUnits, _ScreenUnits]] = ..., + padx: Union[_ScreenUnits, Tuple[_ScreenUnits, _ScreenUnits]] = ..., + pady: Union[_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 @@ -882,7 +882,7 @@ class Toplevel(BaseWidget, Wm): screen: str = ..., # can't be changed after creating widget takefocus: _TakeFocusValue = ..., use: int = ..., - visual: Union[str, tuple[str, int]] = ..., + visual: Union[str, Tuple[str, int]] = ..., width: _ScreenUnits = ..., ) -> None: ... @overload @@ -906,9 +906,9 @@ class Toplevel(BaseWidget, Wm): relief: _Relief = ..., takefocus: _TakeFocusValue = ..., width: _ScreenUnits = ..., - ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure class Button(Widget): @@ -1001,9 +1001,9 @@ class Button(Widget): underline: int = ..., width: _ScreenUnits = ..., wraplength: _ScreenUnits = ..., - ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure def flash(self): ... def invoke(self): ... @@ -1038,7 +1038,7 @@ class Canvas(Widget, XView, YView): relief: _Relief = ..., # Setting scrollregion to None doesn't reset it back to empty, # but setting it to () does. - scrollregion: Union[tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits], tuple[()]] = ..., + scrollregion: Union[Tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits], Tuple[()]] = ..., selectbackground: _Color = ..., selectborderwidth: _ScreenUnits = ..., selectforeground: _Color = ..., @@ -1075,7 +1075,7 @@ class Canvas(Widget, XView, YView): insertwidth: _ScreenUnits = ..., offset: Any = ..., # undocumented relief: _Relief = ..., - scrollregion: Union[tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits], tuple[()]] = ..., + scrollregion: Union[Tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits], Tuple[()]] = ..., selectbackground: _Color = ..., selectborderwidth: _ScreenUnits = ..., selectforeground: _Color = ..., @@ -1086,9 +1086,9 @@ class Canvas(Widget, XView, YView): xscrollincrement: _ScreenUnits = ..., yscrollcommand: _XYScrollCommand = ..., yscrollincrement: _ScreenUnits = ..., - ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure def addtag(self, *args): ... def addtag_above(self, newtag, tagOrId): ... @@ -1130,9 +1130,9 @@ class Canvas(Widget, XView, YView): activestipple: str = ..., activewidth: _ScreenUnits = ..., arrow: Literal["first", "last", "both"] = ..., - arrowshape: tuple[float, float, float] = ..., + arrowshape: Tuple[float, float, float] = ..., capstyle: Literal["round", "projecting", "butt"] = ..., - dash: Union[tuple[float], tuple[float, float], tuple[float, float, float, float]] = ..., + dash: Union[Tuple[float], Tuple[float, float], Tuple[float, float, float, float]] = ..., dashoffset: _ScreenUnits = ..., disableddash: _Color = ..., disabledfill: _Color = ..., @@ -1145,7 +1145,7 @@ class Canvas(Widget, XView, YView): splinesteps: float = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., - tags: Union[str, tuple[str, ...]] = ..., + tags: Union[str, Tuple[str, ...]] = ..., width: _ScreenUnits = ..., ) -> _CanvasObjectId: ... def create_oval( @@ -1161,7 +1161,7 @@ class Canvas(Widget, XView, YView): activeoutlinestipple: _Color = ..., activestipple: str = ..., activewidth: _ScreenUnits = ..., - dash: Union[tuple[float], tuple[float, float], tuple[float, float, float, float]] = ..., + dash: Union[Tuple[float], Tuple[float, float], Tuple[float, float, float, float]] = ..., dashoffset: _ScreenUnits = ..., disableddash: _Color = ..., disabledfill: _Color = ..., @@ -1176,7 +1176,7 @@ class Canvas(Widget, XView, YView): outlinestipple: _Bitmap = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., - tags: Union[str, tuple[str, ...]] = ..., + tags: Union[str, Tuple[str, ...]] = ..., width: _ScreenUnits = ..., ) -> _CanvasObjectId: ... def create_polygon( @@ -1192,7 +1192,7 @@ class Canvas(Widget, XView, YView): activeoutlinestipple: _Color = ..., activestipple: str = ..., activewidth: _ScreenUnits = ..., - dash: Union[tuple[float], tuple[float, float], tuple[float, float, float, float]] = ..., + dash: Union[Tuple[float], Tuple[float, float], Tuple[float, float, float, float]] = ..., dashoffset: _ScreenUnits = ..., disableddash: _Color = ..., disabledfill: _Color = ..., @@ -1210,7 +1210,7 @@ class Canvas(Widget, XView, YView): splinesteps: float = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., - tags: Union[str, tuple[str, ...]] = ..., + tags: Union[str, Tuple[str, ...]] = ..., width: _ScreenUnits = ..., ) -> _CanvasObjectId: ... def create_rectangle( @@ -1226,7 +1226,7 @@ class Canvas(Widget, XView, YView): activeoutlinestipple: _Color = ..., activestipple: str = ..., activewidth: _ScreenUnits = ..., - dash: Union[tuple[float], tuple[float, float], tuple[float, float, float, float]] = ..., + dash: Union[Tuple[float], Tuple[float, float], Tuple[float, float, float, float]] = ..., dashoffset: _ScreenUnits = ..., disableddash: _Color = ..., disabledfill: _Color = ..., @@ -1241,7 +1241,7 @@ class Canvas(Widget, XView, YView): outlinestipple: _Bitmap = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., - tags: Union[str, tuple[str, ...]] = ..., + tags: Union[str, Tuple[str, ...]] = ..., width: _ScreenUnits = ..., ) -> _CanvasObjectId: ... def create_text( @@ -1260,7 +1260,7 @@ class Canvas(Widget, XView, YView): offset: _ScreenUnits = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., - tags: Union[str, tuple[str, ...]] = ..., + tags: Union[str, Tuple[str, ...]] = ..., text: str = ..., width: _ScreenUnits = ..., ) -> _CanvasObjectId: ... @@ -1272,7 +1272,7 @@ class Canvas(Widget, XView, YView): anchor: _Anchor = ..., height: _ScreenUnits = ..., state: Literal["normal", "active", "disabled"] = ..., - tags: Union[str, tuple[str, ...]] = ..., + tags: Union[str, Tuple[str, ...]] = ..., width: _ScreenUnits = ..., window: Widget = ..., ) -> _CanvasObjectId: ... @@ -1420,9 +1420,9 @@ class Checkbutton(Widget): variable: Union[Variable, Literal[""]] = ..., width: _ScreenUnits = ..., wraplength: _ScreenUnits = ..., - ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure def deselect(self): ... def flash(self): ... @@ -1517,9 +1517,9 @@ class Entry(Widget, XView): vcmd: _EntryValidateCommand = ..., width: int = ..., xscrollcommand: _XYScrollCommand = ..., - ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure def delete(self, first, last: Optional[Any] = ...): ... def get(self): ... @@ -1565,7 +1565,7 @@ class Frame(Widget): pady: _ScreenUnits = ..., relief: _Relief = ..., takefocus: _TakeFocusValue = ..., - visual: Union[str, tuple[str, int]] = ..., + visual: Union[str, Tuple[str, int]] = ..., width: _ScreenUnits = ..., ) -> None: ... @overload @@ -1588,9 +1588,9 @@ class Frame(Widget): relief: _Relief = ..., takefocus: _TakeFocusValue = ..., width: _ScreenUnits = ..., - ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure class Label(Widget): @@ -1668,9 +1668,9 @@ class Label(Widget): underline: int = ..., width: _ScreenUnits = ..., wraplength: _ScreenUnits = ..., - ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure class Listbox(Widget, XView, YView): @@ -1758,9 +1758,9 @@ class Listbox(Widget, XView, YView): width: int = ..., xscrollcommand: _XYScrollCommand = ..., yscrollcommand: _XYScrollCommand = ..., - ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure def activate(self, index): ... def bbox(self, index): ... @@ -1846,9 +1846,9 @@ class Menu(Widget): tearoffcommand: Union[Callable[[str, str], Any], str] = ..., title: str = ..., type: Literal["menubar", "tearoff", "normal"] = ..., - ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure def tk_popup(self, x: int, y: int, entry: _MenuIndex = ...): ... def activate(self, index): ... @@ -2137,9 +2137,9 @@ class Menubutton(Widget): underline: int = ..., width: _ScreenUnits = ..., wraplength: _ScreenUnits = ..., - ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure class Message(Widget): @@ -2200,9 +2200,9 @@ class Message(Widget): text: str = ..., textvariable: Variable = ..., width: _ScreenUnits = ..., - ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure class Radiobutton(Widget): @@ -2300,9 +2300,9 @@ class Radiobutton(Widget): variable: Union[Variable, Literal[""]] = ..., width: _ScreenUnits = ..., wraplength: _ScreenUnits = ..., - ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure def deselect(self): ... def flash(self): ... @@ -2391,9 +2391,9 @@ class Scale(Widget): troughcolor: _Color = ..., variable: Union[IntVar, DoubleVar] = ..., width: _ScreenUnits = ..., - ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure def get(self): ... def set(self, value): ... @@ -2417,7 +2417,7 @@ class Scrollbar(Widget): # '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: Union[Callable[..., Optional[tuple[float, float]]], str] = ..., + command: Union[Callable[..., Optional[Tuple[float, float]]], str] = ..., cursor: _Cursor = ..., elementborderwidth: _ScreenUnits = ..., highlightbackground: _Color = ..., @@ -2445,7 +2445,7 @@ class Scrollbar(Widget): bg: _Color = ..., border: _ScreenUnits = ..., borderwidth: _ScreenUnits = ..., - command: Union[Callable[..., Optional[tuple[float, float]]], str] = ..., + command: Union[Callable[..., Optional[Tuple[float, float]]], str] = ..., cursor: _Cursor = ..., elementborderwidth: _ScreenUnits = ..., highlightbackground: _Color = ..., @@ -2459,9 +2459,9 @@ class Scrollbar(Widget): takefocus: _TakeFocusValue = ..., troughcolor: _Color = ..., width: _ScreenUnits = ..., - ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure def activate(self, index: Optional[Any] = ...): ... def delta(self, deltax, deltay): ... @@ -2520,7 +2520,7 @@ class Text(Widget, XView, YView): startline: Union[int, Literal[""]] = ..., state: Literal["normal", "disabled"] = ..., # Literal inside Tuple doesn't actually work - tabs: Union[_ScreenUnits, str, tuple[Union[_ScreenUnits, str], ...]] = ..., + tabs: Union[_ScreenUnits, str, Tuple[Union[_ScreenUnits, str], ...]] = ..., tabstyle: Literal["tabular", "wordprocessor"] = ..., takefocus: _TakeFocusValue = ..., undo: bool = ..., @@ -2571,7 +2571,7 @@ class Text(Widget, XView, YView): spacing3: _ScreenUnits = ..., startline: Union[int, Literal[""]] = ..., state: Literal["normal", "disabled"] = ..., - tabs: Union[_ScreenUnits, str, tuple[Union[_ScreenUnits, str], ...]] = ..., + tabs: Union[_ScreenUnits, str, Tuple[Union[_ScreenUnits, str], ...]] = ..., tabstyle: Literal["tabular", "wordprocessor"] = ..., takefocus: _TakeFocusValue = ..., undo: bool = ..., @@ -2579,11 +2579,11 @@ class Text(Widget, XView, YView): wrap: Literal["none", "char", "word"] = ..., xscrollcommand: _XYScrollCommand = ..., yscrollcommand: _XYScrollCommand = ..., - ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure - def bbox(self, index: _TextIndex) -> Optional[tuple[int, int, int, int]]: ... # type: ignore + def bbox(self, index: _TextIndex) -> Optional[Tuple[int, int, int, int]]: ... # type: ignore def compare(self, index1: _TextIndex, op: Literal["<", "<=", "==", ">=", ">", "!="], index2: _TextIndex) -> bool: ... def count(self, index1, index2, *args): ... # TODO @overload @@ -2591,7 +2591,7 @@ class Text(Widget, XView, YView): @overload def debug(self, boolean: bool) -> None: ... def delete(self, index1: _TextIndex, index2: Optional[_TextIndex] = ...) -> None: ... - def dlineinfo(self, index: _TextIndex) -> Optional[tuple[int, int, int, int, int]]: ... + def dlineinfo(self, index: _TextIndex) -> Optional[Tuple[int, int, int, int, int]]: ... @overload def dump( self, @@ -2605,7 +2605,7 @@ class Text(Widget, XView, YView): tag: bool = ..., text: bool = ..., window: bool = ..., - ) -> List[tuple[str, str, str]]: ... + ) -> List[Tuple[str, str, str]]: ... @overload def dump( self, @@ -2655,14 +2655,14 @@ class Text(Widget, XView, YView): def mark_gravity(self, markName: str, direction: None = ...) -> Literal["left", "right"]: ... @overload def mark_gravity(self, markName: str, direction: Literal["left", "right"]) -> None: ... # actually returns empty string - def mark_names(self) -> tuple[str, ...]: ... + def mark_names(self) -> Tuple[str, ...]: ... def mark_set(self, markName: str, index: _TextIndex) -> None: ... def mark_unset(self, *markNames: str) -> None: ... def mark_next(self, index: _TextIndex) -> Optional[str]: ... def mark_previous(self, index: _TextIndex) -> Optional[str]: ... # **kw of peer_create is same as the kwargs of Text.__init__ def peer_create(self, newPathName: Union[str, Text], cnf: Dict[str, Any] = ..., **kw: Any) -> None: ... - def peer_names(self) -> tuple[_tkinter.Tcl_Obj, ...]: ... + def peer_names(self) -> Tuple[_tkinter.Tcl_Obj, ...]: ... def replace(self, index1: _TextIndex, index2: _TextIndex, chars: str, *args: Union[str, _TkinterSequence[str]]) -> None: ... def scan_mark(self, x: int, y: int) -> None: ... def scan_dragto(self, x: int, y: int) -> None: ... @@ -2729,21 +2729,21 @@ class Text(Widget, XView, YView): underline: bool = ..., underlinefg: _Color = ..., wrap: Literal["none", "char", "word"] = ..., # be careful with "none" vs None - ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... @overload - def tag_configure(self, tagName: str, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def tag_configure(self, tagName: str, cnf: str) -> Tuple[str, str, str, Any, Any]: ... tag_config = tag_configure def tag_delete(self, __first_tag_name: str, *tagNames: str) -> None: ... # error if no tag names given def tag_lower(self, tagName: str, belowThis: Optional[str] = ...) -> None: ... - def tag_names(self, index: Optional[_TextIndex] = ...) -> tuple[str, ...]: ... + def tag_names(self, index: Optional[_TextIndex] = ...) -> Tuple[str, ...]: ... def tag_nextrange( self, tagName: str, index1: _TextIndex, index2: Optional[_TextIndex] = ... - ) -> Union[tuple[str, str], tuple[()]]: ... + ) -> Union[Tuple[str, str], Tuple[()]]: ... def tag_prevrange( self, tagName: str, index1: _TextIndex, index2: Optional[_TextIndex] = ... - ) -> Union[tuple[str, str], tuple[()]]: ... + ) -> Union[Tuple[str, str], Tuple[()]]: ... def tag_raise(self, tagName: str, aboveThis: Optional[str] = ...) -> None: ... - def tag_ranges(self, tagName: str) -> tuple[_tkinter.Tcl_Obj, ...]: ... + def tag_ranges(self, tagName: str) -> Tuple[_tkinter.Tcl_Obj, ...]: ... # tag_remove and tag_delete are different def tag_remove(self, tagName: str, index1: _TextIndex, index2: Optional[_TextIndex] = ...) -> None: ... # TODO: window_* methods @@ -2828,11 +2828,11 @@ class PhotoImage(Image): def copy(self) -> PhotoImage: ... def zoom(self, x: int, y: Union[int, Literal[""]] = ...) -> PhotoImage: ... def subsample(self, x: int, y: Union[int, Literal[""]] = ...) -> PhotoImage: ... - def get(self, x: int, y: int) -> tuple[int, int, int]: ... + def get(self, x: int, y: int) -> Tuple[int, int, int]: ... def put( - self, data: Union[str, _TkinterSequence[str], _TkinterSequence2D[_Color]], to: Optional[tuple[int, int]] = ... + self, data: Union[str, _TkinterSequence[str], _TkinterSequence2D[_Color]], to: Optional[Tuple[int, int]] = ... ) -> None: ... - def write(self, filename: AnyPath, format: Optional[str] = ..., from_coords: Optional[tuple[int, int]] = ...) -> None: ... + def write(self, filename: AnyPath, format: Optional[str] = ..., from_coords: Optional[Tuple[int, int]] = ...) -> None: ... if sys.version_info >= (3, 8): def transparency_get(self, x: int, y: int) -> bool: ... def transparency_set(self, x: int, y: int, boolean: bool) -> None: ... @@ -2852,8 +2852,8 @@ class BitmapImage(Image): maskfile: AnyPath = ..., ) -> None: ... -def image_names() -> tuple[str, ...]: ... -def image_types() -> tuple[str, ...]: ... +def image_names() -> Tuple[str, ...]: ... +def image_types() -> Tuple[str, ...]: ... class Spinbox(Widget, XView): def __init__( @@ -2969,9 +2969,9 @@ class Spinbox(Widget, XView): width: int = ..., wrap: bool = ..., xscrollcommand: _XYScrollCommand = ..., - ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure def bbox(self, index): ... def delete(self, first, last: Optional[Any] = ...): ... @@ -2984,7 +2984,7 @@ class Spinbox(Widget, XView): def scan(self, *args): ... def scan_mark(self, x): ... def scan_dragto(self, x): ... - def selection(self, *args: Any) -> tuple[int, ...]: ... + def selection(self, *args: Any) -> Tuple[int, ...]: ... def selection_adjust(self, index): ... def selection_clear(self): ... def selection_element(self, element: Optional[Any] = ...): ... @@ -3025,7 +3025,7 @@ class LabelFrame(Widget): relief: _Relief = ..., takefocus: _TakeFocusValue = ..., text: str = ..., - visual: Union[str, tuple[str, int]] = ..., + visual: Union[str, Tuple[str, int]] = ..., width: _ScreenUnits = ..., ) -> None: ... @overload @@ -3054,9 +3054,9 @@ class LabelFrame(Widget): takefocus: _TakeFocusValue = ..., text: str = ..., width: _ScreenUnits = ..., - ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure class PanedWindow(Widget): @@ -3114,9 +3114,9 @@ class PanedWindow(Widget): sashwidth: _ScreenUnits = ..., showhandle: bool = ..., width: _ScreenUnits = ..., - ) -> Optional[Dict[str, tuple[str, str, str, Any, Any]]]: ... + ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... @overload - def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... + def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure def add(self, child, **kw): ... def remove(self, child): ... From 9f3d67a3746248670770aa785697a1997a240f64 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Sat, 10 Apr 2021 18:40:59 -0700 Subject: [PATCH 10/15] Use bool I guess. --- stdlib/tkinter/__init__.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 8f3a5e96bb9e..6b7bd5e75c3b 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -1141,7 +1141,7 @@ class Canvas(Widget, XView, YView): fill: _Color = ..., joinstyle: Literal["round", "bevel", "miter"] = ..., offset: _ScreenUnits = ..., - smooth: Literal[0, 1] = ..., + smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., @@ -1206,7 +1206,7 @@ class Canvas(Widget, XView, YView): outline: _Color = ..., outlineoffset: _ScreenUnits = ..., outlinestipple: _Bitmap = ..., - smooth: Literal[0, 1] = ..., + smooth: bool = ..., splinesteps: float = ..., state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., From 43819242109722d9d32a74f5442df96b64f3c309 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Sat, 17 Apr 2021 14:59:59 -0700 Subject: [PATCH 11/15] Addressed some more feedback. --- stdlib/tkinter/__init__.pyi | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 6b7bd5e75c3b..2c81a0920070 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -125,7 +125,7 @@ _ScreenUnits = Union[str, float] # manual page: Tk_GetPixels _XYScrollCommand = Union[str, Callable[[float, float], Any]] # -xscrollcommand and -yscrollcommand in 'options' manual page _TakeFocusValue = Union[int, Literal[""], Callable[[str], Optional[bool]]] # -takefocus in manual page named 'options' -_CanvasObjectId = NewType("_CanvasObjectId", int) +_CanvasItemId = NewType("_CanvasItemId", int) class EventType(str, Enum): Activate: str = ... @@ -1115,9 +1115,9 @@ class Canvas(Widget, XView, YView): def canvasx(self, screenx, gridspacing: Optional[Any] = ...): ... def canvasy(self, screeny, gridspacing: Optional[Any] = ...): ... def coords(self, *args): ... - def create_arc(self, *args, **kw) -> _CanvasObjectId: ... - def create_bitmap(self, *args, **kw) -> _CanvasObjectId: ... - def create_image(self, *args, **kw) -> _CanvasObjectId: ... + def create_arc(self, *args, **kw) -> _CanvasItemId: ... + def create_bitmap(self, *args, **kw) -> _CanvasItemId: ... + def create_image(self, *args, **kw) -> _CanvasItemId: ... def create_line( self, __x0: float, @@ -1147,7 +1147,7 @@ class Canvas(Widget, XView, YView): stipple: _Bitmap = ..., tags: Union[str, Tuple[str, ...]] = ..., width: _ScreenUnits = ..., - ) -> _CanvasObjectId: ... + ) -> _CanvasItemId: ... def create_oval( self, __x0: float, @@ -1178,14 +1178,14 @@ class Canvas(Widget, XView, YView): stipple: _Bitmap = ..., tags: Union[str, Tuple[str, ...]] = ..., width: _ScreenUnits = ..., - ) -> _CanvasObjectId: ... + ) -> _CanvasItemId: ... def create_polygon( self, __x0: float, __y0: float, __x1: float, __y1: float, - *args: float, + *xy_pairs: float, activedash: _Color = ..., activefill: _Color = ..., activeoutline: _Color = ..., @@ -1212,7 +1212,7 @@ class Canvas(Widget, XView, YView): stipple: _Bitmap = ..., tags: Union[str, Tuple[str, ...]] = ..., width: _ScreenUnits = ..., - ) -> _CanvasObjectId: ... + ) -> _CanvasItemId: ... def create_rectangle( self, __x0: float, @@ -1243,7 +1243,7 @@ class Canvas(Widget, XView, YView): stipple: _Bitmap = ..., tags: Union[str, Tuple[str, ...]] = ..., width: _ScreenUnits = ..., - ) -> _CanvasObjectId: ... + ) -> _CanvasItemId: ... def create_text( self, __x: float, @@ -1263,7 +1263,7 @@ class Canvas(Widget, XView, YView): tags: Union[str, Tuple[str, ...]] = ..., text: str = ..., width: _ScreenUnits = ..., - ) -> _CanvasObjectId: ... + ) -> _CanvasItemId: ... def create_window( self, __x: float, @@ -1275,18 +1275,18 @@ class Canvas(Widget, XView, YView): tags: Union[str, Tuple[str, ...]] = ..., width: _ScreenUnits = ..., window: Widget = ..., - ) -> _CanvasObjectId: ... + ) -> _CanvasItemId: ... def dchars(self, *args): ... - def delete(self, *args: Union[_CanvasObjectId, Iterable[_CanvasObjectId]]) -> None: ... + def delete(self, *tagsOrCanvasIds: Union[str, _CanvasItemId]) -> None: ... def dtag(self, *args): ... def find(self, *args): ... - def find_above(self, tagOrId): ... + def find_above(self, tagOrId: Union[str, _CanvasItemId]): ... def find_all(self): ... - def find_below(self, tagOrId): ... + def find_below(self, tagOrId: Union[str, _CanvasItemId]): ... def find_closest(self, x, y, halo: Optional[Any] = ..., start: Optional[Any] = ...): ... def find_enclosed(self, x1, y1, x2, y2): ... def find_overlapping(self, x1, y1, x2, y2): ... - def find_withtag(self, tagOrId): ... + def find_withtag(self, tagOrId: Union[str, _CanvasItemId]): ... def focus(self, *args): ... def gettags(self, *args): ... def icursor(self, *args): ... @@ -1299,7 +1299,7 @@ class Canvas(Widget, XView, YView): lower: Any def move(self, *args): ... if sys.version_info >= (3, 8): - def moveto(self, tagOrId: Union[int, str], x: str = ..., y: str = ...) -> None: ... + def moveto(self, tagOrId: Union[str, _CanvasItemId], x: str = ..., y: str = ...) -> None: ... def postscript(self, cnf=..., **kw): ... def tag_raise(self, *args): ... lift: Any From 2cd9d6a53b872d3d01b087bc56552111ab5997f0 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 21 Apr 2021 09:22:22 -0700 Subject: [PATCH 12/15] Switch to type alias. --- stdlib/tkinter/__init__.pyi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 2c81a0920070..7624f088f948 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -106,6 +106,7 @@ _TkinterSequence2D = Union[List[List[_T]], List[Tuple[_T, ...]], Tuple[List[_T], _Anchor = Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] # manual page: Tk_GetAnchor _Bitmap = str # manual page: Tk_GetBitmap _ButtonCommand = Union[str, Callable[[], Any]] # return value is returned from Button.invoke() +_CanvasItemId = int # handles for items created on a canvas - can be passed to Canvas.delete() _Color = str # typically '#rrggbb', '#rgb' or color names. _Compound = Literal["top", "left", "center", "right", "bottom", "none"] # -compound in manual page named 'options' _Cursor = Union[str, Tuple[str], Tuple[str, str], Tuple[str, str, str], Tuple[str, str, str, str]] # manual page: Tk_GetCursor @@ -125,8 +126,6 @@ _ScreenUnits = Union[str, float] # manual page: Tk_GetPixels _XYScrollCommand = Union[str, Callable[[float, float], Any]] # -xscrollcommand and -yscrollcommand in 'options' manual page _TakeFocusValue = Union[int, Literal[""], Callable[[str], Optional[bool]]] # -takefocus in manual page named 'options' -_CanvasItemId = NewType("_CanvasItemId", int) - class EventType(str, Enum): Activate: str = ... ButtonPress: str = ... From 9fdba60deb95ee8643829cda7a99329424f0f997 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 21 Apr 2021 09:22:45 -0700 Subject: [PATCH 13/15] Remove unused NewType import. --- 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 7624f088f948..d72ccc6db330 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -22,7 +22,7 @@ from typing import ( Union, overload, ) -from typing_extensions import Literal, NewType, TypedDict +from typing_extensions import Literal, TypedDict # Using anything from tkinter.font in this file means that 'import tkinter' # seems to also load tkinter.font. That's not how it actually works, but From 9a7a6b756d6f1362acc9555937fa176f3af66ab2 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 21 Apr 2021 14:17:56 -0700 Subject: [PATCH 14/15] Update stdlib/tkinter/__init__.pyi Co-authored-by: Akuli --- stdlib/tkinter/__init__.pyi | 1 - 1 file changed, 1 deletion(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index d72ccc6db330..ca7b6cc3593c 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -10,7 +10,6 @@ from typing import ( Callable, Dict, Generic, - Iterable, List, Mapping, Optional, From 47308ec86dde26a475aac42a93fca1693baaa346 Mon Sep 17 00:00:00 2001 From: Akuli Date: Thu, 22 Apr 2021 00:24:18 +0300 Subject: [PATCH 15/15] black --- 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 ca7b6cc3593c..5d46d8ab60b9 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -105,7 +105,7 @@ _TkinterSequence2D = Union[List[List[_T]], List[Tuple[_T, ...]], Tuple[List[_T], _Anchor = Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"] # manual page: Tk_GetAnchor _Bitmap = str # manual page: Tk_GetBitmap _ButtonCommand = Union[str, Callable[[], Any]] # return value is returned from Button.invoke() -_CanvasItemId = int # handles for items created on a canvas - can be passed to Canvas.delete() +_CanvasItemId = int # handles for items created on a canvas - can be passed to Canvas.delete() _Color = str # typically '#rrggbb', '#rgb' or color names. _Compound = Literal["top", "left", "center", "right", "bottom", "none"] # -compound in manual page named 'options' _Cursor = Union[str, Tuple[str], Tuple[str, str], Tuple[str, str, str], Tuple[str, str, str, str]] # manual page: Tk_GetCursor