From 4069ca4af549c560f135b33b6ed9ee828edc0a6b Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Thu, 18 Nov 2021 09:32:46 -0800 Subject: [PATCH] Correct `add` parameter for tkinter.Misc.bind() function The documentation[1] for the `bind()` method in tkinter states that the `add` parameter is a string argument. Previously the type-hints had it as a boolean. The implementation[2] actually supports either a bool or a str (or any "truthy") value. 1. https://docs.python.org/3/library/tkinter.html#bindings-and-events 2. https://github.com/python/cpython/blob/32959108f9c543e3cb9f2b68bbc782bddded6f42/Lib/tkinter/__init__.py#L1372 Fixes #6332 --- stdlib/tkinter/__init__.pyi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 829db6c012d6..01a5797fd373 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -338,12 +338,12 @@ class Misc: # binds do. The default value of func is not str. @overload def bind( - self, sequence: str | None = ..., func: Callable[[Event[Misc]], Any] | None = ..., add: bool | None = ... + self, sequence: str | None = ..., func: Callable[[Event[Misc]], Any] | None = ..., add: bool | str | None = ... ) -> str: ... @overload - def bind(self, sequence: str | None, func: str, add: bool | None = ...) -> None: ... + def bind(self, sequence: str | None, func: str, add: bool | str | None = ...) -> None: ... @overload - def bind(self, *, func: str, add: bool | None = ...) -> None: ... + def bind(self, *, func: str, add: bool | str | None = ...) -> None: ... # There's no way to know what type of widget bind_all and bind_class # callbacks will get, so those are Misc. @overload