From c3e1875c258eb97456cb762bf7d13d277f36f637 Mon Sep 17 00:00:00 2001 From: Vyom Pathak Date: Sat, 24 Apr 2021 20:03:45 +0530 Subject: [PATCH] Changed: text argument type to support float and int values for Tkinter * Changed: text argument type to support float and int values for Tkinter --- stdlib/tkinter/__init__.pyi | 30 +++++++++++++++--------------- stdlib/tkinter/ttk.pyi | 24 ++++++++++++------------ 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 5d46d8ab6..ea61c2619 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -949,7 +949,7 @@ class Button(Widget): repeatinterval: int = ..., state: Literal["normal", "active", "disabled"] = ..., takefocus: _TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., # We allow the textvariable to be any Variable, not necessarly # StringVar. This is useful for e.g. a button that displays the value # of an IntVar. @@ -994,7 +994,7 @@ class Button(Widget): repeatinterval: int = ..., state: Literal["normal", "active", "disabled"] = ..., takefocus: _TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., textvariable: Variable = ..., underline: int = ..., width: _ScreenUnits = ..., @@ -1259,7 +1259,7 @@ class Canvas(Widget, XView, YView): state: Literal["normal", "active", "disabled"] = ..., stipple: _Bitmap = ..., tags: Union[str, Tuple[str, ...]] = ..., - text: str = ..., + text: Union[float, str] = ..., width: _ScreenUnits = ..., ) -> _CanvasItemId: ... def create_window( @@ -1362,7 +1362,7 @@ class Checkbutton(Widget): selectimage: _ImageSpec = ..., state: Literal["normal", "active", "disabled"] = ..., takefocus: _TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., textvariable: Variable = ..., tristateimage: _ImageSpec = ..., tristatevalue: Any = ..., @@ -1410,7 +1410,7 @@ class Checkbutton(Widget): selectimage: _ImageSpec = ..., state: Literal["normal", "active", "disabled"] = ..., takefocus: _TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., textvariable: Variable = ..., tristateimage: _ImageSpec = ..., tristatevalue: Any = ..., @@ -1624,7 +1624,7 @@ class Label(Widget): relief: _Relief = ..., state: Literal["normal", "active", "disabled"] = ..., takefocus: _TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., textvariable: Variable = ..., underline: int = ..., width: _ScreenUnits = ..., @@ -1661,7 +1661,7 @@ class Label(Widget): relief: _Relief = ..., state: Literal["normal", "active", "disabled"] = ..., takefocus: _TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., textvariable: Variable = ..., underline: int = ..., width: _ScreenUnits = ..., @@ -2090,7 +2090,7 @@ class Menubutton(Widget): relief: _Relief = ..., state: Literal["normal", "active", "disabled"] = ..., takefocus: _TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., textvariable: Variable = ..., underline: int = ..., width: _ScreenUnits = ..., @@ -2130,7 +2130,7 @@ class Menubutton(Widget): relief: _Relief = ..., state: Literal["normal", "active", "disabled"] = ..., takefocus: _TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., textvariable: Variable = ..., underline: int = ..., width: _ScreenUnits = ..., @@ -2166,7 +2166,7 @@ class Message(Widget): pady: _ScreenUnits = ..., relief: _Relief = ..., takefocus: _TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., textvariable: Variable = ..., # there's width but no height width: _ScreenUnits = ..., @@ -2195,7 +2195,7 @@ class Message(Widget): pady: _ScreenUnits = ..., relief: _Relief = ..., takefocus: _TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., textvariable: Variable = ..., width: _ScreenUnits = ..., ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... @@ -2242,7 +2242,7 @@ class Radiobutton(Widget): selectimage: _ImageSpec = ..., state: Literal["normal", "active", "disabled"] = ..., takefocus: _TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., textvariable: Variable = ..., tristateimage: _ImageSpec = ..., tristatevalue: Any = ..., @@ -2289,7 +2289,7 @@ class Radiobutton(Widget): selectimage: _ImageSpec = ..., state: Literal["normal", "active", "disabled"] = ..., takefocus: _TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., textvariable: Variable = ..., tristateimage: _ImageSpec = ..., tristatevalue: Any = ..., @@ -3022,7 +3022,7 @@ class LabelFrame(Widget): pady: _ScreenUnits = ..., relief: _Relief = ..., takefocus: _TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., visual: Union[str, Tuple[str, int]] = ..., width: _ScreenUnits = ..., ) -> None: ... @@ -3050,7 +3050,7 @@ class LabelFrame(Widget): pady: _ScreenUnits = ..., relief: _Relief = ..., takefocus: _TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., width: _ScreenUnits = ..., ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... @overload diff --git a/stdlib/tkinter/ttk.pyi b/stdlib/tkinter/ttk.pyi index 17aa24197..7544e1362 100644 --- a/stdlib/tkinter/ttk.pyi +++ b/stdlib/tkinter/ttk.pyi @@ -49,7 +49,7 @@ class Button(Widget): state: str = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., textvariable: tkinter.Variable = ..., underline: int = ..., width: Union[int, Literal[""]] = ..., @@ -68,7 +68,7 @@ class Button(Widget): state: str = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., textvariable: tkinter.Variable = ..., underline: int = ..., width: Union[int, Literal[""]] = ..., @@ -95,7 +95,7 @@ class Checkbutton(Widget): state: str = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., textvariable: tkinter.Variable = ..., underline: int = ..., # Seems like variable can be empty string, but actually setting it to @@ -119,7 +119,7 @@ class Checkbutton(Widget): state: str = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., textvariable: tkinter.Variable = ..., underline: int = ..., variable: tkinter.Variable = ..., @@ -351,7 +351,7 @@ class Label(Widget): state: str = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., textvariable: tkinter.Variable = ..., underline: int = ..., width: Union[int, Literal[""]] = ..., @@ -377,7 +377,7 @@ class Label(Widget): state: str = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., textvariable: tkinter.Variable = ..., underline: int = ..., width: Union[int, Literal[""]] = ..., @@ -404,7 +404,7 @@ class Labelframe(Widget): relief: tkinter._Relief = ..., # undocumented style: str = ..., takefocus: tkinter._TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., underline: int = ..., width: tkinter._ScreenUnits = ..., ) -> None: ... @@ -423,7 +423,7 @@ class Labelframe(Widget): relief: tkinter._Relief = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., underline: int = ..., width: tkinter._ScreenUnits = ..., ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... @@ -449,7 +449,7 @@ class Menubutton(Widget): state: str = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., textvariable: tkinter.Variable = ..., underline: int = ..., width: Union[int, Literal[""]] = ..., @@ -468,7 +468,7 @@ class Menubutton(Widget): state: str = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., textvariable: tkinter.Variable = ..., underline: int = ..., width: Union[int, Literal[""]] = ..., @@ -622,7 +622,7 @@ class Radiobutton(Widget): state: str = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., textvariable: tkinter.Variable = ..., underline: int = ..., value: Any = ..., @@ -642,7 +642,7 @@ class Radiobutton(Widget): state: str = ..., style: str = ..., takefocus: tkinter._TakeFocusValue = ..., - text: str = ..., + text: Union[float, str] = ..., textvariable: tkinter.Variable = ..., underline: int = ..., value: Any = ...,