Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ttk.OptionMenu radiobuttons aren't unique between two instances of OptionMenu #69870

Closed
BryanOakley mannequin opened this issue Nov 20, 2015 · 8 comments
Closed

ttk.OptionMenu radiobuttons aren't unique between two instances of OptionMenu #69870

BryanOakley mannequin opened this issue Nov 20, 2015 · 8 comments
Assignees
Labels
3.7 (EOL) end of life topic-tkinter type-bug An unexpected behavior, bug, or error

Comments

@BryanOakley
Copy link
Mannequin

BryanOakley mannequin commented Nov 20, 2015

BPO 25684
Nosy @serhiy-storchaka, @Mariatta, @csabella
PRs
  • bpo-25684: ttk.OptionMenu radiobuttons aren't unique between instance… #2276
  • [3.6] bpo-25684: ttk.OptionMenu radiobuttons weren't unique (GH-2276) #2959
  • [2.7] bpo-25684: ttk.OptionMenu radiobuttons weren't unique (GH-2276) #2960
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2017-09-10.06:03:47.096>
    created_at = <Date 2015-11-20.17:24:48.504>
    labels = ['3.7', 'type-bug', 'expert-tkinter']
    title = "ttk.OptionMenu radiobuttons aren't unique between two instances of OptionMenu"
    updated_at = <Date 2017-09-10.06:03:47.094>
    user = 'https://bugs.python.org/BryanOakley'

    bugs.python.org fields:

    activity = <Date 2017-09-10.06:03:47.094>
    actor = 'Mariatta'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2017-09-10.06:03:47.096>
    closer = 'Mariatta'
    components = ['Tkinter']
    creation = <Date 2015-11-20.17:24:48.504>
    creator = 'Bryan.Oakley'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 25684
    keywords = []
    message_count = 8.0
    messages = ['255001', '255099', '296330', '296576', '299548', '299578', '301801', '301802']
    nosy_count = 5.0
    nosy_names = ['gpolo', 'serhiy.storchaka', 'Bryan.Oakley', 'Mariatta', 'cheryl.sabella']
    pr_nums = ['2276', '2959', '2960']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue25684'
    versions = ['Python 2.7', 'Python 3.5', 'Python 3.6', 'Python 3.7']

    @BryanOakley
    Copy link
    Mannequin Author

    BryanOakley mannequin commented Nov 20, 2015

    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.

    @BryanOakley BryanOakley mannequin added topic-tkinter type-bug An unexpected behavior, bug, or error labels Nov 20, 2015
    @serhiy-storchaka serhiy-storchaka self-assigned this Nov 20, 2015
    @serhiy-storchaka
    Copy link
    Member

    Could you provide a patch Bryan?

    @serhiy-storchaka serhiy-storchaka added the 3.7 (EOL) end of life label Oct 24, 2016
    @csabella
    Copy link
    Contributor

    I submitted a patch based on Bryan's original workaround on SO. Thanks.

    @csabella
    Copy link
    Contributor

    I've now added unittests for this change.

    @serhiy-storchaka
    Copy link
    Member

    New changeset a568e52 by Serhiy Storchaka (csabella) in branch 'master':
    bpo-25684: ttk.OptionMenu radiobuttons weren't unique (bpo-2276)
    a568e52

    @serhiy-storchaka
    Copy link
    Member

    New changeset 2bf1586 by Serhiy Storchaka (csabella) in branch '3.6':
    [3.6] bpo-25684: ttk.OptionMenu radiobuttons weren't unique (GH-2276) (bpo-2959)
    2bf1586

    @Mariatta
    Copy link
    Member

    New changeset e1847ea by Mariatta (Cheryl Sabella) in branch '2.7':
    bpo-25684: ttk.OptionMenu radiobuttons weren't unique (GH-2276) (GH-2960)
    e1847ea

    @Mariatta
    Copy link
    Member

    Fixed and backported to 3.6 and 2.7.
    Thanks, all!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life topic-tkinter type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants