I am trying to have a QLabel widget that prints the number of fiducials that have been placed.
I have a function called onMarkupAdded that was previously created to execute some other code when a mark up is placed. I have added to that a self.numFid = self.fiducialNode.GetNumberOfMarkupsAdded() which prints the correct number if you print the variable. I am unsure how to return this value back to setup each time a new fiducial is added.
If I understand your question correctly (I’m struggling to understand the “return this value back to setup” part), then you need to observe the MarkupAddedEvent event of self.fiducialNode.
I didn’t mention but there are a few things to know, such as inheriting VTKObservationMixin in your class that has the onMarkupAdded function, and the argument list of that function (self,caller,event). See examples: