mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-06 21:43:59 +08:00
[tkinter] Annotate several functions (#14631)
This commit is contained in:
+20
-20
@@ -54,34 +54,34 @@ _TkinterTraceFunc: TypeAlias = Callable[[tuple[str, ...]], object]
|
||||
@final
|
||||
class TkappType:
|
||||
# Please keep in sync with tkinter.Tk
|
||||
def adderrorinfo(self, msg, /): ...
|
||||
def adderrorinfo(self, msg: str, /): ...
|
||||
def call(self, command: Any, /, *args: Any) -> Any: ...
|
||||
def createcommand(self, name, func, /): ...
|
||||
def createcommand(self, name: str, func, /): ...
|
||||
if sys.platform != "win32":
|
||||
def createfilehandler(self, file, mask, func, /): ...
|
||||
def deletefilehandler(self, file, /): ...
|
||||
def createfilehandler(self, file, mask: int, func, /): ...
|
||||
def deletefilehandler(self, file, /) -> None: ...
|
||||
|
||||
def createtimerhandler(self, milliseconds, func, /): ...
|
||||
def deletecommand(self, name, /): ...
|
||||
def createtimerhandler(self, milliseconds: int, func, /): ...
|
||||
def deletecommand(self, name: str, /): ...
|
||||
def dooneevent(self, flags: int = 0, /): ...
|
||||
def eval(self, script: str, /) -> str: ...
|
||||
def evalfile(self, fileName, /): ...
|
||||
def exprboolean(self, s, /): ...
|
||||
def exprdouble(self, s, /): ...
|
||||
def exprlong(self, s, /): ...
|
||||
def exprstring(self, s, /): ...
|
||||
def getboolean(self, arg, /): ...
|
||||
def getdouble(self, arg, /): ...
|
||||
def getint(self, arg, /): ...
|
||||
def evalfile(self, fileName: str, /): ...
|
||||
def exprboolean(self, s: str, /): ...
|
||||
def exprdouble(self, s: str, /): ...
|
||||
def exprlong(self, s: str, /): ...
|
||||
def exprstring(self, s: str, /): ...
|
||||
def getboolean(self, arg, /) -> bool: ...
|
||||
def getdouble(self, arg, /) -> float: ...
|
||||
def getint(self, arg, /) -> int: ...
|
||||
def getvar(self, *args, **kwargs): ...
|
||||
def globalgetvar(self, *args, **kwargs): ...
|
||||
def globalsetvar(self, *args, **kwargs): ...
|
||||
def globalunsetvar(self, *args, **kwargs): ...
|
||||
def interpaddr(self) -> int: ...
|
||||
def loadtk(self) -> None: ...
|
||||
def mainloop(self, threshold: int = 0, /): ...
|
||||
def quit(self): ...
|
||||
def record(self, script, /): ...
|
||||
def mainloop(self, threshold: int = 0, /) -> None: ...
|
||||
def quit(self) -> None: ...
|
||||
def record(self, script: str, /): ...
|
||||
def setvar(self, *ags, **kwargs): ...
|
||||
if sys.version_info < (3, 11):
|
||||
@deprecated("Deprecated since Python 3.9; removed in Python 3.11. Use `splitlist()` instead.")
|
||||
@@ -90,7 +90,7 @@ class TkappType:
|
||||
def splitlist(self, arg, /): ...
|
||||
def unsetvar(self, *args, **kwargs): ...
|
||||
def wantobjects(self, *args, **kwargs): ...
|
||||
def willdispatch(self): ...
|
||||
def willdispatch(self) -> None: ...
|
||||
if sys.version_info >= (3, 12):
|
||||
def gettrace(self, /) -> _TkinterTraceFunc | None: ...
|
||||
def settrace(self, func: _TkinterTraceFunc | None, /) -> None: ...
|
||||
@@ -140,5 +140,5 @@ else:
|
||||
/,
|
||||
): ...
|
||||
|
||||
def getbusywaitinterval(): ...
|
||||
def setbusywaitinterval(new_val, /): ...
|
||||
def getbusywaitinterval() -> int: ...
|
||||
def setbusywaitinterval(new_val: int, /) -> None: ...
|
||||
|
||||
+34
-35
@@ -333,12 +333,12 @@ class Variable:
|
||||
@deprecated("Deprecated since Python 3.14. Use `trace_remove()` instead.")
|
||||
def trace_vdelete(self, mode, cbname) -> None: ...
|
||||
@deprecated("Deprecated since Python 3.14. Use `trace_info()` instead.")
|
||||
def trace_vinfo(self): ...
|
||||
def trace_vinfo(self) -> list[Incomplete]: ...
|
||||
else:
|
||||
def trace(self, mode, callback) -> str: ...
|
||||
def trace_variable(self, mode, callback) -> str: ...
|
||||
def trace_vdelete(self, mode, cbname) -> None: ...
|
||||
def trace_vinfo(self): ...
|
||||
def trace_vinfo(self) -> list[Incomplete]: ...
|
||||
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __del__(self) -> None: ...
|
||||
@@ -373,7 +373,7 @@ def mainloop(n: int = 0) -> None: ...
|
||||
getint = int
|
||||
getdouble = float
|
||||
|
||||
def getboolean(s): ...
|
||||
def getboolean(s) -> bool: ...
|
||||
|
||||
_Ts = TypeVarTuple("_Ts")
|
||||
|
||||
@@ -403,9 +403,9 @@ class Misc:
|
||||
def wait_visibility(self, window: Misc | None = None) -> None: ...
|
||||
def setvar(self, name: str = "PY_VAR", value: str = "1") -> None: ...
|
||||
def getvar(self, name: str = "PY_VAR"): ...
|
||||
def getint(self, s): ...
|
||||
def getdouble(self, s): ...
|
||||
def getboolean(self, s): ...
|
||||
def getint(self, s) -> int: ...
|
||||
def getdouble(self, s) -> float: ...
|
||||
def getboolean(self, s) -> bool: ...
|
||||
def focus_set(self) -> None: ...
|
||||
focus = focus_set
|
||||
def focus_force(self) -> None: ...
|
||||
@@ -681,7 +681,7 @@ class XView:
|
||||
@overload
|
||||
def xview(self) -> tuple[float, float]: ...
|
||||
@overload
|
||||
def xview(self, *args): ...
|
||||
def xview(self, *args) -> None: ...
|
||||
def xview_moveto(self, fraction: float) -> None: ...
|
||||
@overload
|
||||
def xview_scroll(self, number: int, what: Literal["units", "pages"]) -> None: ...
|
||||
@@ -692,7 +692,7 @@ class YView:
|
||||
@overload
|
||||
def yview(self) -> tuple[float, float]: ...
|
||||
@overload
|
||||
def yview(self, *args): ...
|
||||
def yview(self, *args) -> None: ...
|
||||
def yview_moveto(self, fraction: float) -> None: ...
|
||||
@overload
|
||||
def yview_scroll(self, number: int, what: Literal["units", "pages"]) -> None: ...
|
||||
@@ -1018,27 +1018,27 @@ class Tk(Misc, Wm):
|
||||
# Tk has __getattr__ so that tk_instance.foo falls back to tk_instance.tk.foo
|
||||
# Please keep in sync with _tkinter.TkappType.
|
||||
# Some methods are intentionally missing because they are inherited from Misc instead.
|
||||
def adderrorinfo(self, msg, /): ...
|
||||
def adderrorinfo(self, msg: str, /): ...
|
||||
def call(self, command: Any, /, *args: Any) -> Any: ...
|
||||
def createcommand(self, name, func, /): ...
|
||||
def createcommand(self, name: str, func, /): ...
|
||||
if sys.platform != "win32":
|
||||
def createfilehandler(self, file, mask, func, /): ...
|
||||
def deletefilehandler(self, file, /): ...
|
||||
def createfilehandler(self, file, mask: int, func, /): ...
|
||||
def deletefilehandler(self, file, /) -> None: ...
|
||||
|
||||
def createtimerhandler(self, milliseconds, func, /): ...
|
||||
def dooneevent(self, flags: int = ..., /): ...
|
||||
def createtimerhandler(self, milliseconds: int, func, /): ...
|
||||
def dooneevent(self, flags: int = 0, /): ...
|
||||
def eval(self, script: str, /) -> str: ...
|
||||
def evalfile(self, fileName, /): ...
|
||||
def exprboolean(self, s, /): ...
|
||||
def exprdouble(self, s, /): ...
|
||||
def exprlong(self, s, /): ...
|
||||
def exprstring(self, s, /): ...
|
||||
def evalfile(self, fileName: str, /): ...
|
||||
def exprboolean(self, s: str, /): ...
|
||||
def exprdouble(self, s: str, /): ...
|
||||
def exprlong(self, s: str, /): ...
|
||||
def exprstring(self, s: str, /): ...
|
||||
def globalgetvar(self, *args, **kwargs): ...
|
||||
def globalsetvar(self, *args, **kwargs): ...
|
||||
def globalunsetvar(self, *args, **kwargs): ...
|
||||
def interpaddr(self) -> int: ...
|
||||
def loadtk(self) -> None: ...
|
||||
def record(self, script, /): ...
|
||||
def record(self, script: str, /): ...
|
||||
if sys.version_info < (3, 11):
|
||||
@deprecated("Deprecated since Python 3.9; removed in Python 3.11. Use `splitlist()` instead.")
|
||||
def split(self, arg, /): ...
|
||||
@@ -1046,7 +1046,7 @@ class Tk(Misc, Wm):
|
||||
def splitlist(self, arg, /): ...
|
||||
def unsetvar(self, *args, **kwargs): ...
|
||||
def wantobjects(self, *args, **kwargs): ...
|
||||
def willdispatch(self): ...
|
||||
def willdispatch(self) -> None: ...
|
||||
|
||||
def Tcl(screenName: str | None = None, baseName: str | None = None, className: str = "Tk", useTk: bool = False) -> Tk: ...
|
||||
|
||||
@@ -1170,8 +1170,8 @@ class Grid:
|
||||
|
||||
class BaseWidget(Misc):
|
||||
master: Misc
|
||||
widgetName: Incomplete
|
||||
def __init__(self, master, widgetName, cnf={}, kw={}, extra=()) -> None: ...
|
||||
widgetName: str
|
||||
def __init__(self, master, widgetName: str, cnf={}, kw={}, extra=()) -> None: ...
|
||||
def destroy(self) -> None: ...
|
||||
|
||||
# This class represents any widget except Toplevel or Tk.
|
||||
@@ -3559,7 +3559,7 @@ class Text(Widget, XView, YView):
|
||||
fgstipple: str = ...,
|
||||
font: _FontDescription = ...,
|
||||
foreground: str = ...,
|
||||
justify: Literal["left", "right", "center"] = ...,
|
||||
justify: Literal["left", "center", "right"] = ...,
|
||||
lmargin1: _ScreenUnits = ...,
|
||||
lmargin2: _ScreenUnits = ...,
|
||||
lmargincolor: str = ...,
|
||||
@@ -3643,7 +3643,6 @@ class _setit:
|
||||
|
||||
# manual page: tk_optionMenu
|
||||
class OptionMenu(Menubutton):
|
||||
widgetName: Incomplete
|
||||
menuname: Incomplete
|
||||
def __init__(
|
||||
# differs from other widgets
|
||||
@@ -4082,19 +4081,19 @@ class PanedWindow(Widget):
|
||||
config = configure
|
||||
def add(self, child: Widget, **kw) -> None: ...
|
||||
def remove(self, child) -> None: ...
|
||||
forget: Incomplete
|
||||
forget = remove # type: ignore[assignment]
|
||||
def identify(self, x: int, y: int): ...
|
||||
def proxy(self, *args): ...
|
||||
def proxy_coord(self): ...
|
||||
def proxy_forget(self): ...
|
||||
def proxy_place(self, x, y): ...
|
||||
def sash(self, *args): ...
|
||||
def sash_coord(self, index): ...
|
||||
def sash_mark(self, index): ...
|
||||
def sash_place(self, index, x, y): ...
|
||||
def proxy(self, *args) -> tuple[Incomplete, ...]: ...
|
||||
def proxy_coord(self) -> tuple[Incomplete, ...]: ...
|
||||
def proxy_forget(self) -> tuple[Incomplete, ...]: ...
|
||||
def proxy_place(self, x, y) -> tuple[Incomplete, ...]: ...
|
||||
def sash(self, *args) -> tuple[Incomplete, ...]: ...
|
||||
def sash_coord(self, index) -> tuple[Incomplete, ...]: ...
|
||||
def sash_mark(self, index) -> tuple[Incomplete, ...]: ...
|
||||
def sash_place(self, index, x, y) -> tuple[Incomplete, ...]: ...
|
||||
def panecget(self, child, option): ...
|
||||
def paneconfigure(self, tagOrId, cnf=None, **kw): ...
|
||||
paneconfig: Incomplete
|
||||
paneconfig = paneconfigure
|
||||
def panes(self): ...
|
||||
|
||||
def _test() -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user