Author fhdrsdg
Recipients epaine, fhdrsdg, serhiy.storchaka
Date 2021-09-11.08:47:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1631350028.39.0.691692219323.issue45160@roundup.psfhosted.org>
In-reply-to
Content
Ah yes, you're right that `command=self._callback` doesn't pass the new value like it should.
Your suggestion does, but throws a "TypeError: 'NoneType' object is not callable" when no command is given when creating the OptionMenu. The current `_setit` implementation uses a `if self.__callback:` check for that.

Should we do something like this?

for val in values:
    menu.add_radiobutton(label=val,
        variable=self._variable)
    if self._callback:
        menu.entryconfigure('last', command=lambda val=val: self._callback(val))


I don't have any experience making pull requests. I might look into it at some point but for now it would be great if you could make it.
History
Date User Action Args
2021-09-11 08:47:08fhdrsdgsetrecipients: + fhdrsdg, serhiy.storchaka, epaine
2021-09-11 08:47:08fhdrsdgsetmessageid: <1631350028.39.0.691692219323.issue45160@roundup.psfhosted.org>
2021-09-11 08:47:08fhdrsdglinkissue45160 messages
2021-09-11 08:47:08fhdrsdgcreate