# qRadioButtons and parameter nodes

**URL:** <https://discourse.slicer.org/t/qradiobuttons-and-parameter-nodes/10377>\
**Category:** Development\
**Created:** [February 21, 2020, 9:23am UTC](https://discourse.slicer.org/t/qradiobuttons-and-parameter-nodes/10377 "2020-02-21T09:23:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Juicy](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@Juicy](https://discourse.slicer.org/u/Juicy)\
**Post date:** [February 21, 2020, 9:23am UTC](https://discourse.slicer.org/t/qradiobuttons-and-parameter-nodes/10377/1 "2020-02-21T09:23:23Z")

</div>

Hi all,

I am having a lot of trouble trying to save and recall the state of a pair of radio buttons (which I have put in a scripted module GUI) from a parameter node.

I have got all my qMRMLNodeComboBox and qSpinBoxes all saving and updating fine but I am having terrible trouble with the qRadioButtons.

Can anyone think of any scripted modules which save and recall the state of radio buttons from a parameter node which I can look at for ideas? I have sifted through quite a few on github but cant find any which use both a parameter node for saving the GUI state and have radio buttons.

Thanks,

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [February 21, 2020, 3:02pm UTC](https://discourse.slicer.org/t/qradiobuttons-and-parameter-nodes/10377/2 "2020-02-21T15:02:51Z")

</div>

See how radio buttons are managed in this Mask Volume effect: [https://github.com/lassoan/SlicerSegmentEditorExtraEffects/blob/master/SegmentEditorMaskVolume/SegmentEditorMaskVolumeLib/SegmentEditorEffect.py](https://github.com/lassoan/SlicerSegmentEditorExtraEffects/blob/master/SegmentEditorMaskVolume/SegmentEditorMaskVolumeLib/SegmentEditorEffect.py)

---

<div class="post-metadata">

**Author:** ![Saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Saima](https://discourse.slicer.org/u/Saima)\
**Post date:** [December 17, 2020, 6:53am UTC](https://discourse.slicer.org/t/qradiobuttons-and-parameter-nodes/10377/3 "2020-12-17T06:53:08Z")

</div>

Hi Andras,  
I am not understanding this error.

File “/home/saima/Slicer-4.11.0-2020-02-25-linux-amd64/ElectricaConductivity/FuzzyClassification/FuzzyClassification.py”, line 136, in updateGUIFromParameterNode  
self.ui.nClass.value = int(self.\_parameterNode.GetParameter(“nnClass”))  
AttributeError: ‘setvalue’ does not exist on QSpinBox and creating new attributes on C++ objects is not allowed

I am trying to create a qspinbox and enabling pathlineedits depending on the qspin value

regards,  
Siama Safdar

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [December 17, 2020, 7:13am UTC](https://discourse.slicer.org/t/qradiobuttons-and-parameter-nodes/10377/4 "2020-12-17T07:13:03Z")

</div>

The code that is in the .py file is not the same that is being executed: the referenced line contains `self.ui.nClass.value`, while you are executing `self.ui.nClass.setvalue`. Restart Slicer to ensure that all previous versions of the module are unloaded.

`setvalue` is indeed incorrect, there is no such method of QSpinBox. You need to fix spelling and write `self.ui.nClass.setValue(...)` or use the `value` property (`self.ui.nClass.value = ...`).
