Skip to content

HorizontalRadioGroup and VerticalRadioGroup can't be enabled/disabled #208

@jenskutilek

Description

@jenskutilek

Modified demo code:

from vanilla import Window, HorizontalRadioGroup, VerticalRadioGroup

class RadioGroupDemo:

    def __init__(self):
        self.w = Window((300, 100))
        self.w.radioGroup = HorizontalRadioGroup(
            "auto",
            ["Option 1", "Option 2"],
            callback=self.radioGroupCallback
        )
        self.w.radioGroup.set(0)
        self.w.radioGroup.enable(True) # <-- added line
        rules = [
            "H:|-[radioGroup]-|",
            "V:|-[radioGroup(==%d)]-|" % self.w.radioGroup.getFittingHeight()
        ]
        self.w.addAutoPosSizeRules(rules)
        self.w.open()

    def radioGroupCallback(self, sender):
        print("radio group edit!", sender.get())

RadioGroupDemo()

enable() throws a traceback for HorizontalRadioGroup and VerticalRadioGroup. It works for RadioGroup.

Traceback (most recent call last):
  File "test_radiogroup.py", line 24, in <module>
    RadioGroupDemo()
  File "test_radiogroup.py", line 13, in __init__
    self.w.radioGroup.enable(True)
  File "venv/lib/python3.10/site-packages/vanilla/vanillaBase.py", line 158, in enable
    self._nsObject.setEnabled_(onOff)
AttributeError: 'VNSStackView' object has no attribute 'setEnabled_'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions