Skip to content

Commit 3caf2eb

Browse files
committed
1 parent 82c9b97 commit 3caf2eb

File tree

2 files changed

+32
-31
lines changed

2 files changed

+32
-31
lines changed

stdlib/_tkinter.pyi

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import sys
2+
from _typeshed import FileDescriptorLike, Incomplete
23
from collections.abc import Callable
34
from typing import Any, ClassVar, Final, final
45
from typing_extensions import TypeAlias, deprecated
@@ -54,22 +55,22 @@ _TkinterTraceFunc: TypeAlias = Callable[[tuple[str, ...]], object]
5455
@final
5556
class TkappType:
5657
# Please keep in sync with tkinter.Tk
57-
def adderrorinfo(self, msg: str, /): ...
58+
def adderrorinfo(self, msg: str, /) -> None: ...
5859
def call(self, command: Any, /, *args: Any) -> Any: ...
59-
def createcommand(self, name: str, func, /): ...
60+
def createcommand(self, name: str, func: Callable[..., object], /) -> None: ...
6061
if sys.platform != "win32":
61-
def createfilehandler(self, file, mask: int, func, /): ...
62-
def deletefilehandler(self, file, /) -> None: ...
62+
def createfilehandler(self, file: FileDescriptorLike, mask: int, func: Callable[..., object], /) -> None: ...
63+
def deletefilehandler(self, file: FileDescriptorLike, /) -> None: ...
6364

64-
def createtimerhandler(self, milliseconds: int, func, /): ...
65-
def deletecommand(self, name: str, /): ...
66-
def dooneevent(self, flags: int = 0, /): ...
65+
def createtimerhandler(self, milliseconds: int, func: Callable[..., object], /): ...
66+
def deletecommand(self, name: str, /) -> None: ...
67+
def dooneevent(self, flags: int = 0, /) -> int: ...
6768
def eval(self, script: str, /) -> str: ...
68-
def evalfile(self, fileName: str, /): ...
69-
def exprboolean(self, s: str, /): ...
70-
def exprdouble(self, s: str, /): ...
71-
def exprlong(self, s: str, /): ...
72-
def exprstring(self, s: str, /): ...
69+
def evalfile(self, fileName: str, /) -> str: ...
70+
def exprboolean(self, s: str, /) -> int: ...
71+
def exprdouble(self, s: str, /) -> float: ...
72+
def exprlong(self, s: str, /) -> int: ...
73+
def exprstring(self, s: str, /) -> str: ...
7374
def getboolean(self, arg, /) -> bool: ...
7475
def getdouble(self, arg, /) -> float: ...
7576
def getint(self, arg, /) -> int: ...
@@ -81,13 +82,13 @@ class TkappType:
8182
def loadtk(self) -> None: ...
8283
def mainloop(self, threshold: int = 0, /) -> None: ...
8384
def quit(self) -> None: ...
84-
def record(self, script: str, /): ...
85+
def record(self, script: str, /) -> str: ...
8586
def setvar(self, *ags, **kwargs): ...
8687
if sys.version_info < (3, 11):
8788
@deprecated("Deprecated since Python 3.9; removed in Python 3.11. Use `splitlist()` instead.")
8889
def split(self, arg, /): ...
8990

90-
def splitlist(self, arg, /): ...
91+
def splitlist(self, arg, /) -> tuple[Incomplete, ...]: ...
9192
def unsetvar(self, *args, **kwargs): ...
9293
def wantobjects(self, *args, **kwargs): ...
9394
def willdispatch(self) -> None: ...
@@ -112,7 +113,7 @@ TK_VERSION: Final[str]
112113

113114
@final
114115
class TkttType:
115-
def deletetimerhandler(self): ...
116+
def deletetimerhandler(self) -> None: ...
116117

117118
if sys.version_info >= (3, 13):
118119
def create(
@@ -125,7 +126,7 @@ if sys.version_info >= (3, 13):
125126
sync: bool = False,
126127
use: str | None = None,
127128
/,
128-
): ...
129+
) -> TkappType: ...
129130

130131
else:
131132
def create(
@@ -138,7 +139,7 @@ else:
138139
sync: bool = False,
139140
use: str | None = None,
140141
/,
141-
): ...
142+
) -> TkappType: ...
142143

143144
def getbusywaitinterval() -> int: ...
144145
def setbusywaitinterval(new_val: int, /) -> None: ...

stdlib/tkinter/__init__.pyi

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import _tkinter
22
import sys
3-
from _typeshed import Incomplete, MaybeNone, StrOrBytesPath
3+
from _typeshed import FileDescriptorLike, Incomplete, MaybeNone, StrOrBytesPath
44
from collections.abc import Callable, Iterable, Mapping, Sequence
55
from tkinter.constants import *
66
from tkinter.font import _FontDescription
@@ -1005,32 +1005,32 @@ class Tk(Misc, Wm):
10051005
# Tk has __getattr__ so that tk_instance.foo falls back to tk_instance.tk.foo
10061006
# Please keep in sync with _tkinter.TkappType.
10071007
# Some methods are intentionally missing because they are inherited from Misc instead.
1008-
def adderrorinfo(self, msg: str, /): ...
1008+
def adderrorinfo(self, msg: str, /) -> None: ...
10091009
def call(self, command: Any, /, *args: Any) -> Any: ...
1010-
def createcommand(self, name: str, func, /): ...
1010+
def createcommand(self, name: str, func: Callable[..., object], /) -> None: ...
10111011
if sys.platform != "win32":
1012-
def createfilehandler(self, file, mask: int, func, /): ...
1013-
def deletefilehandler(self, file, /) -> None: ...
1012+
def createfilehandler(self, file: FileDescriptorLike, mask: int, func: Callable[..., object], /) -> None: ...
1013+
def deletefilehandler(self, file: FileDescriptorLike, /) -> None: ...
10141014

1015-
def createtimerhandler(self, milliseconds: int, func, /): ...
1016-
def dooneevent(self, flags: int = 0, /): ...
1015+
def createtimerhandler(self, milliseconds: int, func: Callable[..., object], /): ...
1016+
def dooneevent(self, flags: int = 0, /) -> int: ...
10171017
def eval(self, script: str, /) -> str: ...
1018-
def evalfile(self, fileName: str, /): ...
1019-
def exprboolean(self, s: str, /): ...
1020-
def exprdouble(self, s: str, /): ...
1021-
def exprlong(self, s: str, /): ...
1022-
def exprstring(self, s: str, /): ...
1018+
def evalfile(self, fileName: str, /) -> str: ...
1019+
def exprboolean(self, s: str, /) -> int: ...
1020+
def exprdouble(self, s: str, /) -> float: ...
1021+
def exprlong(self, s: str, /) -> int: ...
1022+
def exprstring(self, s: str, /) -> str: ...
10231023
def globalgetvar(self, *args, **kwargs): ...
10241024
def globalsetvar(self, *args, **kwargs): ...
10251025
def globalunsetvar(self, *args, **kwargs): ...
10261026
def interpaddr(self) -> int: ...
10271027
def loadtk(self) -> None: ...
1028-
def record(self, script: str, /): ...
1028+
def record(self, script: str, /) -> str: ...
10291029
if sys.version_info < (3, 11):
10301030
@deprecated("Deprecated since Python 3.9; removed in Python 3.11. Use `splitlist()` instead.")
10311031
def split(self, arg, /): ...
10321032

1033-
def splitlist(self, arg, /): ...
1033+
def splitlist(self, arg, /) -> tuple[Incomplete, ...]: ...
10341034
def unsetvar(self, *args, **kwargs): ...
10351035
def wantobjects(self, *args, **kwargs): ...
10361036
def willdispatch(self) -> None: ...

0 commit comments

Comments
 (0)