bpo-45160: Ttk optionmenu only set variable once (GH-28291) (GH-29132)

(cherry picked from commit add46f8476)

Co-authored-by: E-Paine <63801254+E-Paine@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2021-10-21 13:59:20 -07:00 committed by GitHub
parent e628700dbf
commit 04485ac988
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 1 deletions

View file

@ -1643,7 +1643,10 @@ class OptionMenu(Menubutton):
menu.delete(0, 'end')
for val in values:
menu.add_radiobutton(label=val,
command=tkinter._setit(self._variable, val, self._callback),
command=(
None if self._callback is None
else lambda val=val: self._callback(val)
),
variable=self._variable)
if default: