From d835db65cbda4462a9546bd372456e9d854da9a5 Mon Sep 17 00:00:00 2001 From: subotac <73706465+subotac@users.noreply.github.com> Date: Thu, 30 Jul 2026 12:14:05 +0300 Subject: [PATCH 1/2] Fix tkinter.OptionMenu callback type --- stdlib/@tests/test_cases/check_tkinter.py | 2 ++ stdlib/tkinter/__init__.pyi | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/stdlib/@tests/test_cases/check_tkinter.py b/stdlib/@tests/test_cases/check_tkinter.py index eb344f3a234a..52ba45f1ddd1 100644 --- a/stdlib/@tests/test_cases/check_tkinter.py +++ b/stdlib/@tests/test_cases/check_tkinter.py @@ -24,6 +24,8 @@ def foo(x: int, y: str) -> None: root.after(1000, foo, 10, "lol") root.after(1000, foo, 10, 10) # type: ignore +tkinter.OptionMenu(root, tkinter.StringVar(), "option", command=lambda value: assert_type(value, str)) + # Font size must be integer label = tkinter.Label() diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 45001cfea75a..681c6ddba546 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -3905,7 +3905,7 @@ class OptionMenu(Menubutton): variable: StringVar, value: str, *values: str, - command: Callable[[StringVar], object] | None = ..., + command: Callable[[str], object] | None = ..., name: str | None = None, ) -> None: ... else: @@ -3916,7 +3916,7 @@ class OptionMenu(Menubutton): variable: StringVar, value: str, *values: str, - command: Callable[[StringVar], object] | None = ..., + command: Callable[[str], object] | None = ..., ) -> None: ... # configure, config, cget are inherited from Menubutton # destroy and __getitem__ are overridden, signature does not change From c4b03e9621d59cbfb6f3ceb809a619f75aa8b60c Mon Sep 17 00:00:00 2001 From: subotac <73706465+subotac@users.noreply.github.com> Date: Fri, 31 Jul 2026 20:26:23 +0300 Subject: [PATCH 2/2] Remove redundant OptionMenu type test --- stdlib/@tests/test_cases/check_tkinter.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/stdlib/@tests/test_cases/check_tkinter.py b/stdlib/@tests/test_cases/check_tkinter.py index 52ba45f1ddd1..acb9a24ec5b1 100644 --- a/stdlib/@tests/test_cases/check_tkinter.py +++ b/stdlib/@tests/test_cases/check_tkinter.py @@ -24,9 +24,6 @@ def foo(x: int, y: str) -> None: root.after(1000, foo, 10, "lol") root.after(1000, foo, 10, 10) # type: ignore -tkinter.OptionMenu(root, tkinter.StringVar(), "option", command=lambda value: assert_type(value, str)) - - # Font size must be integer label = tkinter.Label() label.config(font=("", 12))