From 4b66a9cd4e1b1afecd0112300b1b06aa14ad9937 Mon Sep 17 00:00:00 2001 From: Akuli Date: Sun, 6 Jun 2021 21:32:30 +0300 Subject: [PATCH] add types to tkinter invoke methods (#5582) --- stdlib/tkinter/__init__.pyi | 9 +++++---- stdlib/tkinter/ttk.pyi | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 45cdc60c0..cb362924b 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -995,7 +995,7 @@ class Button(Widget): def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure def flash(self): ... - def invoke(self): ... + def invoke(self) -> Any: ... class Canvas(Widget, XView, YView): def __init__( @@ -1417,7 +1417,7 @@ class Checkbutton(Widget): config = configure def deselect(self): ... def flash(self): ... - def invoke(self): ... + def invoke(self) -> Any: ... def select(self): ... def toggle(self): ... @@ -2299,7 +2299,7 @@ class Radiobutton(Widget): config = configure def deselect(self): ... def flash(self): ... - def invoke(self): ... + def invoke(self) -> Any: ... def select(self): ... class Scale(Widget): @@ -2971,7 +2971,8 @@ class Spinbox(Widget, XView): def identify(self, x, y): ... def index(self, index): ... def insert(self, index, s): ... - def invoke(self, element): ... + # spinbox.invoke("asdf") gives error mentioning .invoke("none"), but it's not documented + def invoke(self, element: Literal["none", "buttonup", "buttondown"]) -> Literal[""]: ... def scan(self, *args): ... def scan_mark(self, x): ... def scan_dragto(self, x): ... diff --git a/stdlib/tkinter/ttk.pyi b/stdlib/tkinter/ttk.pyi index bbbe9e1ad..595bdaee7 100644 --- a/stdlib/tkinter/ttk.pyi +++ b/stdlib/tkinter/ttk.pyi @@ -76,7 +76,7 @@ class Button(Widget): @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure - def invoke(self): ... + def invoke(self) -> Any: ... class Checkbutton(Widget): def __init__( @@ -128,7 +128,7 @@ class Checkbutton(Widget): @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure - def invoke(self): ... + def invoke(self) -> Any: ... class Entry(Widget, tkinter.Entry): def __init__( @@ -652,7 +652,7 @@ class Radiobutton(Widget): @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure - def invoke(self): ... + def invoke(self) -> Any: ... class Scale(Widget, tkinter.Scale): def __init__(