I’m currently working on a custom Python scripted module. I’m currently trying to create a button that creates a module GUI that allows users to place control points to create a curve. The code I’m using is from the repository: https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#add-a-button-to-module-gui-to-activate-control-point-placement
However, when I press the button, a blank pop-up rapidly appears then disappears. Here’s a video of what happens, though the appearing/disappearing occurs too quickly to be seen.
The code for the button is in a function that I’ve connected to the button.
self.ui.addNodule.connect('clicked(bool)', self.onAddNodule)
def onAddNodule(self):
"""
Run processing when user clicks "Add" button for Nodule.
"""
result = qt.QInputDialog().getText(None, "Add Nodule", "Enter nodule name")
if result != "" and not self.ui.noduleList.findItems(result, qt.Qt.MatchExactly):
self.ui.noduleList.addItem(result)
w = slicer.qSlicerMarkupsPlaceWidget()
w.setMRMLScene(slicer.mrmlScene)
markupsNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLMarkupsClosedCurveNode")
w.setCurrentNode(slicer.mrmlScene.GetNodeByID(markupsNode.GetID()))
# Hide all buttons and only show place button
# w.buttonsVisible=False
w.placeButton().show()
w.show()