From 4ace347e03663435fad415fad853f53b4f9d4a7b Mon Sep 17 00:00:00 2001 From: Vladimir Babin Date: Fri, 30 Oct 2026 15:15:19 +0800 Subject: [PATCH] Fix ttk.OptionMenu command callback parameter type ttk.OptionMenu invokes its command callback with the selected string value (set_menu passes val from *values), not a StringVar. Match the annotation to tkinter.OptionMenu, which already uses str. --- stdlib/tkinter/ttk.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/tkinter/ttk.pyi b/stdlib/tkinter/ttk.pyi index bf184bc2e8f8..dcc4a70412f7 100644 --- a/stdlib/tkinter/ttk.pyi +++ b/stdlib/tkinter/ttk.pyi @@ -1414,7 +1414,7 @@ class OptionMenu(Menubutton): # rest of these are keyword-only because *args syntax used above style: str = "", direction: Literal["above", "below", "left", "right", "flush"] = "below", - command: Callable[[tkinter.StringVar], object] | None = None, + command: Callable[[str], object] | None = None, name: str | None = None, ) -> None: ... else: @@ -1427,7 +1427,7 @@ class OptionMenu(Menubutton): # rest of these are keyword-only because *args syntax used above style: str = "", direction: Literal["above", "below", "left", "right", "flush"] = "below", - command: Callable[[tkinter.StringVar], object] | None = None, + command: Callable[[str], object] | None = None, ) -> None: ... # configure, config, cget, destroy are inherited from Menubutton # destroy and __setitem__ are overridden, signature does not change