AttributeError: qMRMLNodeComboBox has no attribute named 'setNoneEnabled'

Operating system: Ubuntu 20.04
Slicer version: 4.11.20210226
Expected behavior: setNoneEnabled() to disable qMRMLNodeComboBox “none” option
Actual behavior: reported error

My code:

self.ui.fid1MRMLNodeComboBox.nodeTypes = [‘vtkMRMLMarkupsFiducialNode’]

Traceback (most recent call last):
File “/home/yl/se/TMSKuka/TMSKukaGUI/”, line 92, in setup
AttributeError: qMRMLNodeComboBox has no attribute named ‘setNoneEnabled’
Slicer Docs:

From Python this property “noneEnabled” is set directly. You can find examples of its usage in python by searching the Slicer GitHub repo.

self.ui.fid1MRMLNodeComboBox.noneEnabled = False

You may find useful this documentation page, which describes how to read doxygen-generated documentation in Python.

1 Like

Thank you for your reply. Yes I tried it and it worked.

Thank you very much! This is very helpful. I should have seen this earlier.

1 Like