#948·Gooey

Gooey mutually exclusive group description/title problem - 2 potential quick fixes

Author: jeremybradburyCreated Jun 21, 2026Updated Jun 21, 2026

Gooey mutually exclusive group description/title problem and solution

  • OS: macOS
  • Python Version: 3.12
  • Gooey Version: 1.0.8.1
  • Thorough description of problem:

When using GooeyParser.add_mutually_exclusive_group() with description=..., Gooey's Python wrapper currently forwards that argument to argparse._MutuallyExclusiveGroup.__init__, which does not accept description. This raises a TypeError: _MutuallyExclusiveGroup.__init__() got an unexpected keyword argument 'description'.

Additionally, the mutually exclusive group title behavior is not clearly documented: the radio group header is controlled by gooey_options['title'], whereas description is neither consumed nor rendered within the radio widget.

Expected Behavior:

  • add_mutually_exclusive_group(description='...') should be accepted and should not crash.
  • The description should be available to the radio group UI and render beneath the title.
  • gooey_options['title'] should continue to override the radio-group header label and should be documented clearly for this widget.

Actual Behavior:

  • Passing description to a mutually exclusive group raises a TypeError.
  • The radio group currently renders Choose One when no title option is provided, and description is not rendered even when supplied via gooey_options.

Anything else you may think will be helpful: This is a usability bug and a documentation gap. The bug is especially confusing because argparse.ArgumentParser.add_mutually_exclusive_group() appears to support keyword args, but Gooey's wrapper does not handle them correctly. The title override is already supported through gooey_options['title'], but it is not documented in the context of radio/mutually exclusive groups.

Proposed fix - "minimal code examples"

There are two reasonable approaches here; both should be presented so maintainers can decide which API is cleaner.

Option A: support add_mutually_exclusive_group(title, description=...)

This mirrors the existing argparse/add_argument_group() style and keeps title/description aligned with the group API.

Example:

mode_group = group.add_mutually_exclusive_group(
    'Transfer Mode',
    description='Choose how files are transferred',
    gooey_options={
            'title': 'Transfer Mode',
            'description': 'Choose how files are transferred: link, symlink, or copy',  # not supported (yet)
            'initial_selection': 0,
        },,
)

Option B: keep title/description on the enclosing argument group, with radio-item options handled through gooey_options

This is the current Gooey-style direction but makes it explicit that the group header is configured separately from the mutex wrapper.

Example:

transfer_group = parser.add_argument_group(
    'Transfer Mode',
    description='Choose how files are transferred',
    gooey_options=COMPONENT_DEFAULT,
)
mode_group = transfer_group.add_mutually_exclusive_group(
    gooey_options={
        'title': 'Transfer Mode',
        'description': 'Choose how files are transferred: link, symlink, or copy',  # not supported (yet)
        'initial_selection': 0,
        'help_color': text_color, # no color overrides work here
    },
)

Implementation notes

  • In gooey/python_bindings/gooey_parser.py:
    • Accept and store description and title on GooeyMutuallyExclusiveGroup without forwarding them to argparse._MutuallyExclusiveGroup.
    • Preserve existing behavior for gooey_options.
  • In gooey/python_bindings/argparse_to_json.py:
    • In build_radio_group(), inject the stored description (and optionally title) into the radio group's options or widget JSON.
    • Allow radio group header title to come from either gooey_options['title'] or mutex_group.title.
  • In gooey/gui/components/widgets/radio_group.py:
    • Render options['description'] under the title when present.

Notes

  • This should keep backward compatibility for existing Gooey users.
  • It also adds a documented way to customize both the header and the explanatory text for mutually exclusive/radio groups.
  • Both fixes would be great, because Option A is more consistent with the existing argparse API and may be more intuitive for users familiar with that style. Option B keeps Gooey's configuration style but may require more documentation to clarify the separation of concerns between the argument group and the mutex wrapper.
  • I don't want to go down a rabbit hole on a PR, without some maintainer feedback, and I'd be happy if you want to take this on yourself! I primarily wanted to document the issue and a proposed resolution. Thanks for all your work on Gooey!