-
-
Notifications
You must be signed in to change notification settings - Fork 2k
[tkinter] Annotate few methods #15273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import _tkinter | ||
| import sys | ||
| from _typeshed import Incomplete, MaybeNone, StrOrBytesPath | ||
| from _typeshed import FileDescriptorLike, Incomplete, MaybeNone, StrOrBytesPath | ||
| from collections.abc import Callable, Iterable, Mapping, Sequence | ||
| from tkinter.constants import * | ||
| from tkinter.font import _FontDescription | ||
|
|
@@ -1005,34 +1005,43 @@ 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: str, /): ... | ||
| def adderrorinfo(self, msg: str, /) -> None: ... | ||
| def call(self, command: Any, /, *args: Any) -> Any: ... | ||
| def createcommand(self, name: str, func, /): ... | ||
| # TODO: Figure out what arguments the following `func` callbacks should accept | ||
| def createcommand(self, name: str, func: Callable[..., object], /) -> None: ... | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure that
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems to be a callback that takes two arguments like in createfilehandler. But I decided to leave it like that for now because I wasn't sure about it.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add a "TODO" comment to this and the other callables?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like the arguments are always passed as strings, but I might be missing something. Keyword arguments are never given, because they are not a thing in Tcl. |
||
| if sys.platform != "win32": | ||
| def createfilehandler(self, file, mask: int, func, /): ... | ||
| def deletefilehandler(self, file, /) -> None: ... | ||
| def createfilehandler(self, file: FileDescriptorLike, mask: int, func: Callable[..., object], /) -> None: ... | ||
donbarbos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| def deletefilehandler(self, file: FileDescriptorLike, /) -> None: ... | ||
|
|
||
| def createtimerhandler(self, milliseconds: int, func, /): ... | ||
| def dooneevent(self, flags: int = 0, /): ... | ||
| def createtimerhandler(self, milliseconds: int, func: Callable[..., object], /): ... | ||
donbarbos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| def dooneevent(self, flags: int = 0, /) -> int: ... | ||
| def eval(self, script: str, /) -> str: ... | ||
| 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 evalfile(self, fileName: str, /) -> str: ... | ||
| def exprboolean(self, s: str, /) -> Literal[0, 1]: ... | ||
| def exprdouble(self, s: str, /) -> float: ... | ||
| def exprlong(self, s: str, /) -> int: ... | ||
| def exprstring(self, s: str, /) -> 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: str, /): ... | ||
| def record(self, script: str, /) -> 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, /): ... | ||
|
|
||
| def splitlist(self, arg, /): ... | ||
| def splitlist(self, arg, /) -> tuple[Incomplete, ...]: ... | ||
| def unsetvar(self, *args, **kwargs): ... | ||
| def wantobjects(self, *args, **kwargs): ... | ||
| if sys.version_info >= (3, 14): | ||
| @overload | ||
| def wantobjects(self) -> Literal[0, 1]: ... | ||
| else: | ||
| @overload | ||
| def wantobjects(self) -> bool: ... | ||
|
|
||
| @overload | ||
| def wantobjects(self, wantobjects: Literal[0, 1] | bool, /) -> None: ... | ||
| def willdispatch(self) -> None: ... | ||
|
|
||
| def Tcl(screenName: str | None = None, baseName: str | None = None, className: str = "Tk", useTk: bool = False) -> Tk: ... | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.