Issue 25684: ttk.OptionMenu radiobuttons aren't unique between two instances of OptionMenu - Python tracker

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: Bryan.Oakley, Mariatta, cheryl.sabella, gpolo, serhiy.storchaka
Priority: normal Keywords:

Created on 2015-11-20 17:24 by Bryan.Oakley, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 2276 merged cheryl.sabella, 2017-06-19 13:03
PR 2959 merged cheryl.sabella, 2017-07-31 11:08
PR 2960 merged cheryl.sabella, 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 (cheryl.sabella) * (Python committer) Date: 2017-06-19 13:20
I submitted a patch based on Bryan's original workaround on SO.  Thanks.
msg296576 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) 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 (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 (Mariatta) * (Python committer) Date: 2017-09-10 06:03
Fixed and backported to 3.6 and 2.7.
Thanks, all!