Title: ttk.OptionMenu radiobuttons aren't unique between two instances of OptionMenu
Type: behavior Stage: patch review
Components: Tkinter Versions: Python 3.7, Python 3.6, Python 3.5, Python 2.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: Bryan.Oakley, csabella, gpolo, serhiy.storchaka
Priority: normal Keywords:

Created on 2015-11-20 17:24 by Bryan.Oakley, last changed 2017-07-16 16:49 by serhiy.storchaka.

Pull Requests
URL Status Linked Edit
PR 2276 open csabella, 2017-06-19 13:03
Messages (4)
msg255001 - (view) Author: Bryan Oakley (Bryan.Oakley) Date: 2015-11-20 17:24
Original issue was brought to my attention by this SO question:

The ttk.OptionMenu uses radiobuttons for the dropdown menu. However, because it doesn't set the `variable` attribute, they all get the default. If you have two or more OptionMenu instances, all of the radiobuttons are tied together. If you select the first item in the first OptionMenu, and the second item in the second OptionMenu, the dropdown menu for both will show the second item checked.

The solution is to add `variable=self._variable` when creating the menu radiobutton items.
msg255099 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-11-22 13:05
Could you provide a patch Bryan?
msg296330 - (view) Author: Cheryl Sabella (csabella) * Date: 2017-06-19 13:20
I submitted a patch based on Bryan's original workaround on SO.  Thanks.
msg296576 - (view) Author: Cheryl Sabella (csabella) * Date: 2017-06-21 19:28
I've now added unittests for this change.
Date User Action Args
2017-07-16 16:49:26serhiy.storchakasetstage: needs patch -> patch review
2017-06-21 19:28:10csabellasetnosy: + gpolo
messages: + msg296576
2017-06-19 13:20:30csabellasetnosy: + csabella
messages: + msg296330
2017-06-19 13:03:01csabellasetpull_requests: + pull_request2325
2016-10-24 20:56:38serhiy.storchakasetversions: + Python 3.7, - Python 3.4
2015-11-22 13:05:21serhiy.storchakasetmessages: + msg255099
2015-11-20 18:19:25serhiy.storchakasetassignee: serhiy.storchaka
stage: needs patch

nosy: + serhiy.storchaka
versions: - Python 3.2, Python 3.3
2015-11-20 17:25:41Bryan.Oakleysettype: behavior
2015-11-20 17:24:48Bryan.Oakleycreate