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

Created on 2015-11-20 17:24 by Bryan.Oakley, last changed 2017-09-10 06:03 by Mariatta. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 2276 merged csabella, 2017-06-19 13:03
PR 2959 merged csabella, 2017-07-31 11:08
PR 2960 merged csabella, 2017-07-31 16:22
Messages (8)
msg255001 - (view) Author: Bryan Oakley (Bryan.Oakley) Date: 2015-11-20 17:24
Original issue was brought to my attention by this SO question: http://stackoverflow.com/questions/33831289/ttk-optionmenu-displaying-check-mark-on-all-menus

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.
msg299548 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-07-31 09:30
New changeset a568e5273382a5dca0c27274f7d8e34c41a87d4d by Serhiy Storchaka (csabella) in branch 'master':
bpo-25684: ttk.OptionMenu radiobuttons weren't unique (#2276)
https://github.com/python/cpython/commit/a568e5273382a5dca0c27274f7d8e34c41a87d4d
msg299578 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-07-31 19:10
New changeset 2bf1586e60a6639b532cd8e3442ae33064523eb1 by Serhiy Storchaka (csabella) in branch '3.6':
[3.6] bpo-25684: ttk.OptionMenu radiobuttons weren't unique (GH-2276) (#2959)
https://github.com/python/cpython/commit/2bf1586e60a6639b532cd8e3442ae33064523eb1
msg301801 - (view) Author: Mariatta Wijaya (Mariatta) * (Python committer) Date: 2017-09-10 06:02
New changeset e1847ea4a9bdc7549893091a63e14f2afbdecc32 by Mariatta (Cheryl Sabella) in branch '2.7':
bpo-25684: ttk.OptionMenu radiobuttons weren't unique (GH-2276) (GH-2960)
https://github.com/python/cpython/commit/e1847ea4a9bdc7549893091a63e14f2afbdecc32
msg301802 - (view) Author: Mariatta Wijaya (Mariatta) * (Python committer) Date: 2017-09-10 06:03
Fixed and backported to 3.6 and 2.7.
Thanks, all!
History
Date User Action Args
2017-09-10 06:03:47Mariattasetstatus: open -> closed
resolution: fixed
messages: + msg301802

stage: patch review -> resolved
2017-09-10 06:02:17Mariattasetnosy: + Mariatta
messages: + msg301801
2017-07-31 19:10:16serhiy.storchakasetmessages: + msg299578
2017-07-31 16:22:51csabellasetpull_requests: + pull_request3008
2017-07-31 11:08:42csabellasetpull_requests: + pull_request3007
2017-07-31 09:30:11serhiy.storchakasetmessages: + msg299548
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