Quick Q for RemoveObserver

Hi all,
quick question about “RemoveObserver”==>
After I did the following to add one observer
“”"
crosshairNode=slicer.util.getNode(“Crosshair”)
crosshairNode.AddObserver(slicer.vtkMRMLCrosshairNode.CursorPositionModifiedEvent, self.onMouseMoved)
“”"
I did try
crosshairNode.RemoveObserver(slicer.vtkMRMLCrosshairNode.CursorPositionModifiedEvent)
but no effect from this line.

how to remove the observer?

You can remove an observer using the tag generated when the observer was added. See the this example in the script repository.

1 Like

Thanks a lot for the solution.
It worked after taking all parameters to the root “self”.