mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-06 13:33:59 +08:00
Add some missing type hints to tkinter (#6359)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
This commit is contained in:
+97
-88
@@ -126,7 +126,7 @@ class Event(Generic[_W_co]):
|
||||
widget: _W_co
|
||||
delta: int
|
||||
|
||||
def NoDefaultRoot(): ...
|
||||
def NoDefaultRoot() -> None: ...
|
||||
|
||||
_TraceMode = Literal["array", "read", "write", "unset"]
|
||||
|
||||
@@ -139,7 +139,7 @@ class Variable:
|
||||
def trace_remove(self, mode: _TraceMode, cbname: str) -> None: ...
|
||||
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_vdelete(self, mode, cbname) -> None: ... # deprecated
|
||||
def trace_vinfo(self): ... # deprecated
|
||||
trace = trace_variable # deprecated
|
||||
|
||||
@@ -187,13 +187,13 @@ class Misc:
|
||||
def destroy(self) -> None: ...
|
||||
def deletecommand(self, name: str) -> None: ...
|
||||
def tk_strictMotif(self, boolean: Any | None = ...): ...
|
||||
def tk_bisque(self): ...
|
||||
def tk_setPalette(self, *args, **kw): ...
|
||||
def tk_bisque(self) -> None: ...
|
||||
def tk_setPalette(self, *args, **kw) -> None: ...
|
||||
def wait_variable(self, name: str | Variable = ...) -> None: ...
|
||||
waitvar = wait_variable
|
||||
def wait_window(self, window: Misc | None = ...) -> None: ...
|
||||
def wait_visibility(self, window: Misc | None = ...) -> None: ...
|
||||
def setvar(self, name: str = ..., value: str = ...): ...
|
||||
def setvar(self, name: str = ..., value: str = ...) -> None: ...
|
||||
def getvar(self, name: str = ...): ...
|
||||
def getint(self, s): ...
|
||||
def getdouble(self, s): ...
|
||||
@@ -214,30 +214,32 @@ class Misc:
|
||||
# after_idle is essentially partialmethod(after, "idle")
|
||||
def after_idle(self, func: Callable[..., Any], *args: Any) -> str: ...
|
||||
def after_cancel(self, id: str) -> None: ...
|
||||
def bell(self, displayof: Literal[0] | Misc | None = ...): ...
|
||||
def bell(self, displayof: Literal[0] | Misc | None = ...) -> None: ...
|
||||
def clipboard_get(self, *, displayof: Misc = ..., type: str = ...) -> str: ...
|
||||
def clipboard_clear(self, *, displayof: Misc = ...) -> None: ...
|
||||
def clipboard_append(self, string: str, *, displayof: Misc = ..., format: str = ..., type: str = ...): ...
|
||||
def clipboard_append(self, string: str, *, displayof: Misc = ..., format: str = ..., type: str = ...) -> None: ...
|
||||
def grab_current(self): ...
|
||||
def grab_release(self): ...
|
||||
def grab_release(self) -> None: ...
|
||||
def grab_set(self) -> None: ...
|
||||
def grab_set_global(self) -> None: ...
|
||||
def grab_status(self): ...
|
||||
def option_add(self, pattern, value, priority: Any | None = ...): ...
|
||||
def option_clear(self): ...
|
||||
def grab_status(self) -> Literal["local", "global"] | None: ...
|
||||
def option_add(
|
||||
self, pattern, value, priority: int | Literal["widgetDefault", "startupFile", "userDefault", "interactive"] | None = ...
|
||||
) -> None: ...
|
||||
def option_clear(self) -> None: ...
|
||||
def option_get(self, name, className): ...
|
||||
def option_readfile(self, fileName, priority: Any | None = ...): ...
|
||||
def selection_clear(self, **kw): ...
|
||||
def option_readfile(self, fileName, priority: Any | None = ...) -> None: ...
|
||||
def selection_clear(self, **kw) -> None: ...
|
||||
def selection_get(self, **kw): ...
|
||||
def selection_handle(self, command, **kw): ...
|
||||
def selection_own(self, **kw): ...
|
||||
def selection_handle(self, command, **kw) -> None: ...
|
||||
def selection_own(self, **kw) -> None: ...
|
||||
def selection_own_get(self, **kw): ...
|
||||
def send(self, interp, cmd, *args): ...
|
||||
def lower(self, belowThis: Any | None = ...): ...
|
||||
def tkraise(self, aboveThis: Any | None = ...): ...
|
||||
def lower(self, belowThis: Any | None = ...) -> None: ...
|
||||
def tkraise(self, aboveThis: Any | None = ...) -> None: ...
|
||||
lift = tkraise
|
||||
def winfo_atom(self, name: str, displayof: Literal[0] | Misc | None = ...): ...
|
||||
def winfo_atomname(self, id: int, displayof: Literal[0] | Misc | None = ...): ...
|
||||
def winfo_atom(self, name: str, displayof: Literal[0] | Misc | None = ...) -> int: ...
|
||||
def winfo_atomname(self, id: int, displayof: Literal[0] | Misc | None = ...) -> str: ...
|
||||
def winfo_cells(self) -> int: ...
|
||||
def winfo_children(self) -> list[Widget]: ... # Widget because it can't be Toplevel or Tk
|
||||
def winfo_class(self) -> str: ...
|
||||
@@ -287,7 +289,10 @@ class Misc:
|
||||
def winfo_y(self) -> int: ...
|
||||
def update(self) -> None: ...
|
||||
def update_idletasks(self) -> None: ...
|
||||
def bindtags(self, tagList: Any | None = ...): ...
|
||||
@overload
|
||||
def bindtags(self, tagList: None = ...) -> tuple[str, ...]: ...
|
||||
@overload
|
||||
def bindtags(self, tagList: list[str] | tuple[str, ...]) -> None: ...
|
||||
# bind with isinstance(func, str) doesn't return anything, but all other
|
||||
# binds do. The default value of func is not str.
|
||||
@overload
|
||||
@@ -330,7 +335,7 @@ class Misc:
|
||||
def unbind_all(self, sequence: str) -> None: ...
|
||||
def unbind_class(self, className: str, sequence: str) -> None: ...
|
||||
def mainloop(self, n: int = ...) -> None: ...
|
||||
def quit(self): ...
|
||||
def quit(self) -> None: ...
|
||||
def nametowidget(self, name: str | Misc | _tkinter.Tcl_Obj) -> Any: ...
|
||||
def register(
|
||||
self, func: Callable[..., Any], subst: Callable[..., Sequence[Any]] | None = ..., needcleanup: int = ...
|
||||
@@ -434,7 +439,7 @@ class CallWrapper:
|
||||
func: Any
|
||||
subst: Any
|
||||
widget: Any
|
||||
def __init__(self, func, subst, widget): ...
|
||||
def __init__(self, func, subst, widget) -> None: ...
|
||||
def __call__(self, *args): ...
|
||||
|
||||
class XView:
|
||||
@@ -488,11 +493,11 @@ class Wm:
|
||||
# Some of these always return empty string, but return type is set to None to prevent accidentally using it
|
||||
def wm_deiconify(self) -> None: ...
|
||||
deiconify = wm_deiconify
|
||||
def wm_focusmodel(self, model: Any | None = ...): ...
|
||||
def wm_focusmodel(self, model: Literal["active", "passive"] | None = ...) -> Literal["active", "passive", ""]: ...
|
||||
focusmodel = wm_focusmodel
|
||||
def wm_forget(self, window: Wm) -> None: ...
|
||||
forget = wm_forget
|
||||
def wm_frame(self): ...
|
||||
def wm_frame(self) -> str: ...
|
||||
frame = wm_frame
|
||||
@overload
|
||||
def wm_geometry(self, newGeometry: None = ...) -> str: ...
|
||||
@@ -511,15 +516,15 @@ class Wm:
|
||||
iconify = wm_iconify
|
||||
def wm_iconmask(self, bitmap: Any | None = ...): ...
|
||||
iconmask = wm_iconmask
|
||||
def wm_iconname(self, newName: Any | None = ...): ...
|
||||
def wm_iconname(self, newName: Any | None = ...) -> str: ...
|
||||
iconname = wm_iconname
|
||||
def wm_iconphoto(self, default: bool, __image1: Image, *args: Image) -> None: ...
|
||||
iconphoto = wm_iconphoto
|
||||
def wm_iconposition(self, x: Any | None = ..., y: Any | None = ...): ...
|
||||
def wm_iconposition(self, x: int | None = ..., y: int | None = ...) -> tuple[int, int] | None: ...
|
||||
iconposition = wm_iconposition
|
||||
def wm_iconwindow(self, pathName: Any | None = ...): ...
|
||||
iconwindow = wm_iconwindow
|
||||
def wm_manage(self, widget): ...
|
||||
def wm_manage(self, widget) -> None: ...
|
||||
manage = wm_manage
|
||||
@overload
|
||||
def wm_maxsize(self, width: None = ..., height: None = ...) -> tuple[int, int]: ...
|
||||
@@ -536,7 +541,7 @@ class Wm:
|
||||
@overload
|
||||
def wm_overrideredirect(self, boolean: bool) -> None: ...
|
||||
overrideredirect = wm_overrideredirect
|
||||
def wm_positionfrom(self, who: Any | None = ...): ...
|
||||
def wm_positionfrom(self, who: Literal["program", "user"] | None = ...) -> Literal["", "program", "user"]: ...
|
||||
positionfrom = wm_positionfrom
|
||||
@overload
|
||||
def wm_protocol(self, name: str, func: Callable[[], Any] | str) -> None: ...
|
||||
@@ -550,7 +555,7 @@ class Wm:
|
||||
@overload
|
||||
def wm_resizable(self, width: bool, height: bool) -> None: ...
|
||||
resizable = wm_resizable
|
||||
def wm_sizefrom(self, who: Any | None = ...): ...
|
||||
def wm_sizefrom(self, who: Literal["program", "user"] | None = ...) -> Literal["", "program", "user"]: ...
|
||||
sizefrom = wm_sizefrom
|
||||
@overload
|
||||
def wm_state(self, newstate: None = ...) -> str: ...
|
||||
@@ -576,7 +581,9 @@ class _ExceptionReportingCallback(Protocol):
|
||||
class Tk(Misc, Wm):
|
||||
master: None
|
||||
def __init__(
|
||||
# please update ttkthemes stub if you change this
|
||||
# Make sure to keep in sync with other functions that use the same
|
||||
# args.
|
||||
# use `git grep screenName` to find them
|
||||
self,
|
||||
screenName: str | None = ...,
|
||||
baseName: str | None = ...,
|
||||
@@ -645,7 +652,7 @@ class Tk(Misc, Wm):
|
||||
def wantobjects(self, *args, **kwargs): ...
|
||||
def willdispatch(self): ...
|
||||
|
||||
def Tcl(screenName: Any | None = ..., baseName: Any | None = ..., className: str = ..., useTk: bool = ...): ...
|
||||
def Tcl(screenName: str | None = ..., baseName: str | None = ..., className: str = ..., useTk: bool = ...) -> Tk: ...
|
||||
|
||||
_InMiscTotal = TypedDict("_InMiscTotal", {"in": Misc})
|
||||
_InMiscNonTotal = TypedDict("_InMiscNonTotal", {"in": Misc}, total=False)
|
||||
@@ -765,7 +772,7 @@ class Grid:
|
||||
class BaseWidget(Misc):
|
||||
master: Misc
|
||||
widgetName: Any
|
||||
def __init__(self, master, widgetName, cnf=..., kw=..., extra=...): ...
|
||||
def __init__(self, master, widgetName, cnf=..., kw=..., extra=...) -> None: ...
|
||||
def destroy(self) -> None: ...
|
||||
|
||||
# This class represents any widget except Toplevel or Tk.
|
||||
@@ -938,7 +945,7 @@ class Button(Widget):
|
||||
@overload
|
||||
def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
|
||||
config = configure
|
||||
def flash(self): ...
|
||||
def flash(self) -> None: ...
|
||||
def invoke(self) -> Any: ...
|
||||
|
||||
class Canvas(Widget, XView, YView):
|
||||
@@ -1394,7 +1401,7 @@ class Canvas(Widget, XView, YView):
|
||||
width: _ScreenUnits = ...,
|
||||
window: Widget = ...,
|
||||
) -> _CanvasItemId: ...
|
||||
def dchars(self, *args): ...
|
||||
def dchars(self, *args) -> None: ...
|
||||
def delete(self, *tagsOrCanvasIds: str | _CanvasItemId) -> None: ...
|
||||
@overload
|
||||
def dtag(self, __tag: str, __tag_to_delete: str | None = ...) -> None: ...
|
||||
@@ -1402,16 +1409,16 @@ class Canvas(Widget, XView, YView):
|
||||
def dtag(self, __id: _CanvasItemId, __tag_to_delete: str) -> None: ...
|
||||
def focus(self, *args): ...
|
||||
def gettags(self, __tagOrId: str | _CanvasItemId) -> tuple[str, ...]: ...
|
||||
def icursor(self, *args): ...
|
||||
def icursor(self, *args) -> None: ...
|
||||
def index(self, *args): ...
|
||||
def insert(self, *args): ...
|
||||
def insert(self, *args) -> None: ...
|
||||
def itemcget(self, tagOrId, option): ...
|
||||
# itemconfigure kwargs depend on item type, which is not known when type checking
|
||||
def itemconfigure(
|
||||
self, tagOrId: str | _CanvasItemId, cnf: dict[str, Any] | None = ..., **kw: Any
|
||||
) -> dict[str, tuple[str, str, str, str, str]] | None: ...
|
||||
itemconfig = itemconfigure
|
||||
def move(self, *args): ...
|
||||
def move(self, *args) -> None: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def moveto(self, tagOrId: str | _CanvasItemId, x: Literal[""] | float = ..., y: Literal[""] | float = ...) -> None: ...
|
||||
|
||||
@@ -1426,14 +1433,14 @@ class Canvas(Widget, XView, YView):
|
||||
def tag_raise(self, __first: str | _CanvasItemId, __second: str | _CanvasItemId | None = ...) -> None: ...
|
||||
def tkraise(self, __first: str | _CanvasItemId, __second: str | _CanvasItemId | None = ...) -> None: ... # type: ignore[override]
|
||||
def lift(self, __first: str | _CanvasItemId, __second: str | _CanvasItemId | None = ...) -> None: ... # type: ignore[override]
|
||||
def scale(self, *args): ...
|
||||
def scan_mark(self, x, y): ...
|
||||
def scan_dragto(self, x, y, gain: int = ...): ...
|
||||
def select_adjust(self, tagOrId, index): ...
|
||||
def select_clear(self): ...
|
||||
def select_from(self, tagOrId, index): ...
|
||||
def scale(self, *args) -> None: ...
|
||||
def scan_mark(self, x, y) -> None: ...
|
||||
def scan_dragto(self, x, y, gain: int = ...) -> None: ...
|
||||
def select_adjust(self, tagOrId, index) -> None: ...
|
||||
def select_clear(self) -> None: ...
|
||||
def select_from(self, tagOrId, index) -> None: ...
|
||||
def select_item(self): ...
|
||||
def select_to(self, tagOrId, index): ...
|
||||
def select_to(self, tagOrId, index) -> None: ...
|
||||
def type(self, tagOrId): ...
|
||||
|
||||
class Checkbutton(Widget):
|
||||
@@ -1547,11 +1554,11 @@ class Checkbutton(Widget):
|
||||
@overload
|
||||
def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
|
||||
config = configure
|
||||
def deselect(self): ...
|
||||
def flash(self): ...
|
||||
def deselect(self) -> None: ...
|
||||
def flash(self) -> None: ...
|
||||
def invoke(self) -> Any: ...
|
||||
def select(self): ...
|
||||
def toggle(self): ...
|
||||
def select(self) -> None: ...
|
||||
def toggle(self) -> None: ...
|
||||
|
||||
_EntryIndex = Union[str, int] # "INDICES" in manual page
|
||||
|
||||
@@ -1651,8 +1658,8 @@ class Entry(Widget, XView):
|
||||
def icursor(self, index: _EntryIndex) -> None: ...
|
||||
def index(self, index: _EntryIndex) -> int: ...
|
||||
def insert(self, index: _EntryIndex, string: str) -> None: ...
|
||||
def scan_mark(self, x): ...
|
||||
def scan_dragto(self, x): ...
|
||||
def scan_mark(self, x) -> None: ...
|
||||
def scan_dragto(self, x) -> None: ...
|
||||
def selection_adjust(self, index: _EntryIndex) -> None: ...
|
||||
def selection_clear(self) -> None: ... # type: ignore[override]
|
||||
def selection_from(self, index: _EntryIndex) -> None: ...
|
||||
@@ -1887,26 +1894,26 @@ class Listbox(Widget, XView, YView):
|
||||
@overload
|
||||
def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
|
||||
config = configure
|
||||
def activate(self, index): ...
|
||||
def bbox(self, index): ...
|
||||
def activate(self, index) -> None: ...
|
||||
def bbox(self, index) -> tuple[int, int, int, int] | None: ... # type: ignore[override]
|
||||
def curselection(self): ...
|
||||
def delete(self, first, last: Any | None = ...): ...
|
||||
def delete(self, first, last: Any | None = ...) -> None: ...
|
||||
def get(self, first, last: Any | None = ...): ...
|
||||
def index(self, index): ...
|
||||
def insert(self, index, *elements): ...
|
||||
def insert(self, index, *elements) -> None: ...
|
||||
def nearest(self, y): ...
|
||||
def scan_mark(self, x, y): ...
|
||||
def scan_dragto(self, x, y): ...
|
||||
def see(self, index): ...
|
||||
def selection_anchor(self, index): ...
|
||||
def scan_mark(self, x, y) -> None: ...
|
||||
def scan_dragto(self, x, y) -> None: ...
|
||||
def see(self, index) -> None: ...
|
||||
def selection_anchor(self, index) -> None: ...
|
||||
select_anchor: Any
|
||||
def selection_clear(self, first, last: Any | None = ...): ... # type: ignore[override]
|
||||
def selection_clear(self, first, last: Any | None = ...) -> None: ... # type: ignore[override]
|
||||
select_clear: Any
|
||||
def selection_includes(self, index): ...
|
||||
select_includes: Any
|
||||
def selection_set(self, first, last: Any | None = ...): ...
|
||||
def selection_set(self, first, last: Any | None = ...) -> None: ...
|
||||
select_set: Any
|
||||
def size(self): ...
|
||||
def size(self) -> int: ... # type: ignore[override]
|
||||
def itemcget(self, index, option): ...
|
||||
def itemconfigure(self, index, cnf: Any | None = ..., **kw): ...
|
||||
itemconfig: Any
|
||||
@@ -2431,10 +2438,10 @@ class Radiobutton(Widget):
|
||||
@overload
|
||||
def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
|
||||
config = configure
|
||||
def deselect(self): ...
|
||||
def flash(self): ...
|
||||
def deselect(self) -> None: ...
|
||||
def flash(self) -> None: ...
|
||||
def invoke(self) -> Any: ...
|
||||
def select(self): ...
|
||||
def select(self) -> None: ...
|
||||
|
||||
class Scale(Widget):
|
||||
def __init__(
|
||||
@@ -2522,10 +2529,10 @@ class Scale(Widget):
|
||||
@overload
|
||||
def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
|
||||
config = configure
|
||||
def get(self): ...
|
||||
def set(self, value): ...
|
||||
def coords(self, value: Any | None = ...): ...
|
||||
def identify(self, x, y): ...
|
||||
def get(self) -> float: ...
|
||||
def set(self, value) -> None: ...
|
||||
def coords(self, value: float | None = ...) -> tuple[int, int]: ...
|
||||
def identify(self, x, y) -> Literal["", "slider", "trough1", "trough2"]: ...
|
||||
|
||||
class Scrollbar(Widget):
|
||||
def __init__(
|
||||
@@ -2591,11 +2598,11 @@ class Scrollbar(Widget):
|
||||
def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
|
||||
config = configure
|
||||
def activate(self, index: Any | None = ...): ...
|
||||
def delta(self, deltax, deltay): ...
|
||||
def fraction(self, x, y): ...
|
||||
def identify(self, x, y): ...
|
||||
def get(self): ...
|
||||
def set(self, first, last): ...
|
||||
def delta(self, deltax: int, deltay: int) -> float: ...
|
||||
def fraction(self, x: int, y: int) -> float: ...
|
||||
def identify(self, x: int, y: int) -> Literal["arrow1", "arrow2", "slider", "trough1", "trough2", ""]: ...
|
||||
def get(self) -> tuple[float, float, float, float] | tuple[float, float]: ...
|
||||
def set(self, first: float, last: float) -> None: ...
|
||||
|
||||
_TextIndex = Union[_tkinter.Tcl_Obj, str, float, Misc]
|
||||
|
||||
@@ -2873,13 +2880,13 @@ class Text(Widget, XView, YView):
|
||||
def window_cget(self, index, option): ...
|
||||
def window_configure(self, index, cnf: Any | None = ..., **kw): ...
|
||||
window_config = window_configure
|
||||
def window_create(self, index, cnf=..., **kw): ...
|
||||
def window_create(self, index, cnf=..., **kw) -> None: ...
|
||||
def window_names(self): ...
|
||||
def yview_pickplace(self, *what): ... # deprecated
|
||||
|
||||
class _setit:
|
||||
def __init__(self, var, value, callback: Any | None = ...): ...
|
||||
def __call__(self, *args): ...
|
||||
def __init__(self, var, value, callback: Any | None = ...) -> None: ...
|
||||
def __call__(self, *args) -> None: ...
|
||||
|
||||
# manual page: tk_optionMenu
|
||||
class OptionMenu(Menubutton):
|
||||
@@ -2906,9 +2913,11 @@ class _Image(Protocol):
|
||||
class Image:
|
||||
name: Any
|
||||
tk: _tkinter.TkappType
|
||||
def __init__(self, imgtype, name: Any | None = ..., cnf=..., master: Misc | _tkinter.TkappType | None = ..., **kw): ...
|
||||
def __del__(self): ...
|
||||
def __setitem__(self, key, value): ...
|
||||
def __init__(
|
||||
self, imgtype, name: Any | None = ..., cnf=..., master: Misc | _tkinter.TkappType | None = ..., **kw
|
||||
) -> None: ...
|
||||
def __del__(self) -> None: ...
|
||||
def __setitem__(self, key, value) -> None: ...
|
||||
def __getitem__(self, key): ...
|
||||
configure: Any
|
||||
config: Any
|
||||
@@ -3104,13 +3113,13 @@ class Spinbox(Widget, XView):
|
||||
@overload
|
||||
def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
|
||||
config = configure
|
||||
def bbox(self, index): ...
|
||||
def delete(self, first, last: Any | None = ...): ...
|
||||
def get(self): ...
|
||||
def bbox(self, index) -> tuple[int, int, int, int] | None: ... # type: ignore[override]
|
||||
def delete(self, first, last: Any | None = ...) -> Literal[""]: ...
|
||||
def get(self) -> str: ...
|
||||
def icursor(self, index): ...
|
||||
def identify(self, x, y): ...
|
||||
def index(self, index): ...
|
||||
def insert(self, index, s): ...
|
||||
def identify(self, x: int, y: int) -> Literal["", "buttondown", "buttonup", "entry"]: ...
|
||||
def index(self, index: _EntryIndex) -> int: ...
|
||||
def insert(self, index: _EntryIndex, s: str) -> Literal[""]: ...
|
||||
# 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): ...
|
||||
@@ -3250,10 +3259,10 @@ class PanedWindow(Widget):
|
||||
@overload
|
||||
def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
|
||||
config = configure
|
||||
def add(self, child: Widget, **kw): ...
|
||||
def remove(self, child): ...
|
||||
def add(self, child: Widget, **kw) -> None: ...
|
||||
def remove(self, child) -> None: ...
|
||||
forget: Any
|
||||
def identify(self, x, y): ...
|
||||
def identify(self, x: int, y: int): ...
|
||||
def proxy(self, *args): ...
|
||||
def proxy_coord(self): ...
|
||||
def proxy_forget(self): ...
|
||||
|
||||
@@ -46,7 +46,7 @@ class LoadFileDialog(FileDialog):
|
||||
|
||||
class SaveFileDialog(FileDialog):
|
||||
title: str
|
||||
def ok_command(self): ...
|
||||
def ok_command(self) -> None: ...
|
||||
|
||||
class _Dialog(commondialog.Dialog): ...
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ from typing import Any
|
||||
class Dialog(Toplevel):
|
||||
def __init__(self, parent: Misc | None, title: str | None = ...) -> None: ...
|
||||
def body(self, master) -> None: ...
|
||||
def buttonbox(self): ...
|
||||
def buttonbox(self) -> None: ...
|
||||
|
||||
class SimpleDialog:
|
||||
def __init__(
|
||||
|
||||
@@ -45,7 +45,7 @@ class tixCommand:
|
||||
def tix_resetoptions(self, newScheme: str, newFontSet: str, newScmPrio: str | None = ...) -> None: ...
|
||||
|
||||
class Tk(tkinter.Tk, tixCommand):
|
||||
def __init__(self, screenName: str | None = ..., baseName: str | None = ..., className: str = ...): ...
|
||||
def __init__(self, screenName: str | None = ..., baseName: str | None = ..., className: str = ...) -> None: ...
|
||||
|
||||
class TixWidget(tkinter.Widget):
|
||||
def __init__(
|
||||
|
||||
+26
-24
@@ -5,7 +5,7 @@ from tkinter.font import _FontDescription
|
||||
from typing import Any, Callable, Union, overload
|
||||
from typing_extensions import Literal, TypedDict
|
||||
|
||||
def tclobjs_to_py(adict): ...
|
||||
def tclobjs_to_py(adict: dict[Any, Any]) -> dict[Any, Any]: ...
|
||||
def setup_master(master: Any | None = ...): ...
|
||||
|
||||
# from ttk_widget (aka ttk::widget) manual page, differs from tkinter._Compound
|
||||
@@ -14,16 +14,16 @@ _TtkCompound = Literal["text", "image", tkinter._Compound]
|
||||
class Style:
|
||||
master: Any
|
||||
tk: _tkinter.TkappType
|
||||
def __init__(self, master: tkinter.Misc | None = ...): ...
|
||||
def __init__(self, master: tkinter.Misc | None = ...) -> None: ...
|
||||
def configure(self, style, query_opt: Any | None = ..., **kw): ...
|
||||
def map(self, style, query_opt: Any | None = ..., **kw): ...
|
||||
def lookup(self, style, option, state: Any | None = ..., default: Any | None = ...): ...
|
||||
def layout(self, style, layoutspec: Any | None = ...): ...
|
||||
def element_create(self, elementname, etype, *args, **kw): ...
|
||||
def element_create(self, elementname, etype, *args, **kw) -> None: ...
|
||||
def element_names(self): ...
|
||||
def element_options(self, elementname): ...
|
||||
def theme_create(self, themename, parent: Any | None = ..., settings: Any | None = ...): ...
|
||||
def theme_settings(self, themename, settings): ...
|
||||
def theme_create(self, themename, parent: Any | None = ..., settings: Any | None = ...) -> None: ...
|
||||
def theme_settings(self, themename, settings) -> None: ...
|
||||
def theme_names(self) -> tuple[str, ...]: ...
|
||||
@overload
|
||||
def theme_use(self, themename: str) -> None: ...
|
||||
@@ -31,8 +31,8 @@ class Style:
|
||||
def theme_use(self, themename: None = ...) -> str: ...
|
||||
|
||||
class Widget(tkinter.Widget):
|
||||
def __init__(self, master: tkinter.Misc | None, widgetname, kw: Any | None = ...): ...
|
||||
def identify(self, x, y): ...
|
||||
def __init__(self, master: tkinter.Misc | None, widgetname, kw: Any | None = ...) -> None: ...
|
||||
def identify(self, x: int, y: int) -> str: ...
|
||||
def instate(self, statespec, callback: Any | None = ..., *args, **kw): ...
|
||||
def state(self, statespec: Any | None = ...): ...
|
||||
|
||||
@@ -207,8 +207,8 @@ class Entry(Widget, tkinter.Entry):
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
|
||||
@overload
|
||||
def config(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
|
||||
def bbox(self, index): ...
|
||||
def identify(self, x, y): ...
|
||||
def bbox(self, index) -> tuple[int, int, int, int]: ... # type: ignore[override]
|
||||
def identify(self, x: int, y: int) -> str: ...
|
||||
def validate(self): ...
|
||||
|
||||
class Combobox(Entry):
|
||||
@@ -293,8 +293,8 @@ class Combobox(Entry):
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
|
||||
@overload
|
||||
def config(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
|
||||
def current(self, newindex: Any | None = ...): ...
|
||||
def set(self, value): ...
|
||||
def current(self, newindex: int | None = ...) -> int: ...
|
||||
def set(self, value: Any) -> None: ...
|
||||
|
||||
class Frame(Widget):
|
||||
def __init__(
|
||||
@@ -521,11 +521,11 @@ class Notebook(Widget):
|
||||
compound: tkinter._Compound = ...,
|
||||
underline: int = ...,
|
||||
) -> None: ...
|
||||
def forget(self, tab_id): ...
|
||||
def hide(self, tab_id): ...
|
||||
def identify(self, x, y): ...
|
||||
def forget(self, tab_id) -> None: ...
|
||||
def hide(self, tab_id) -> None: ...
|
||||
def identify(self, x: int, y: int) -> str: ...
|
||||
def index(self, tab_id): ...
|
||||
def insert(self, pos, child, **kw): ...
|
||||
def insert(self, pos, child, **kw) -> None: ...
|
||||
def select(self, tab_id: Any | None = ...): ...
|
||||
def tab(self, tab_id, option: Any | None = ..., **kw): ...
|
||||
def tabs(self): ...
|
||||
@@ -575,7 +575,7 @@ class Panedwindow(Widget, tkinter.PanedWindow):
|
||||
@overload
|
||||
def config(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
|
||||
forget: Any
|
||||
def insert(self, pos, child, **kw): ...
|
||||
def insert(self, pos, child, **kw) -> None: ...
|
||||
def pane(self, pane, option: Any | None = ..., **kw): ...
|
||||
def sashpos(self, index, newpos: Any | None = ...): ...
|
||||
|
||||
@@ -618,9 +618,9 @@ class Progressbar(Widget):
|
||||
@overload
|
||||
def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
|
||||
config = configure
|
||||
def start(self, interval: Any | None = ...): ...
|
||||
def step(self, amount: Any | None = ...): ...
|
||||
def stop(self): ...
|
||||
def start(self, interval: Literal["idle"] | int | None = ...) -> None: ...
|
||||
def step(self, amount: float | None = ...) -> None: ...
|
||||
def stop(self) -> None: ...
|
||||
|
||||
class Radiobutton(Widget):
|
||||
def __init__(
|
||||
@@ -669,7 +669,8 @@ class Radiobutton(Widget):
|
||||
config = configure
|
||||
def invoke(self) -> Any: ...
|
||||
|
||||
class Scale(Widget, tkinter.Scale):
|
||||
# type ignore, because identify() methods of Widget and tkinter.Scale are incompatible
|
||||
class Scale(Widget, tkinter.Scale): # type: ignore[misc]
|
||||
def __init__(
|
||||
self,
|
||||
master: tkinter.Misc | None = ...,
|
||||
@@ -727,9 +728,10 @@ class Scale(Widget, tkinter.Scale):
|
||||
) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
|
||||
@overload
|
||||
def config(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
|
||||
def get(self, x: Any | None = ..., y: Any | None = ...): ...
|
||||
def get(self, x: int | None = ..., y: int | None = ...) -> float: ...
|
||||
|
||||
class Scrollbar(Widget, tkinter.Scrollbar):
|
||||
# type ignore, because identify() methods of Widget and tkinter.Scale are incompatible
|
||||
class Scrollbar(Widget, tkinter.Scrollbar): # type: ignore[misc]
|
||||
def __init__(
|
||||
self,
|
||||
master: tkinter.Misc | None = ...,
|
||||
@@ -1014,7 +1016,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView):
|
||||
anchor: tkinter._Anchor = ...,
|
||||
command: str | Callable[[], Any] = ...,
|
||||
) -> None: ...
|
||||
def identify(self, component, x, y): ...
|
||||
def identify(self, component, x, y): ... # Internal Method. Leave untyped
|
||||
def identify_row(self, y: int) -> str: ...
|
||||
def identify_column(self, x: int) -> str: ...
|
||||
def identify_region(self, x: int, y: int) -> Literal["heading", "separator", "tree", "cell", "nothing"]: ...
|
||||
@@ -1144,4 +1146,4 @@ class OptionMenu(Menubutton):
|
||||
) -> None: ...
|
||||
# configure, config, cget, destroy are inherited from Menubutton
|
||||
# destroy and __setitem__ are overridden, signature does not change
|
||||
def set_menu(self, default: Any | None = ..., *values): ...
|
||||
def set_menu(self, default: Any | None = ..., *values) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user