Sequence Get & Set Current Frame

I’m trying to get and set the current ‘frame’ (timepoint) of a vtkMRMLSequenceBrowserNode in python.

I can use browserNode.SelectNextItem(0) to get the current frame without error, but then following that when playing the sequence using default sequence playback tools, I repeatedly get the error in the python interactor TypeError: observe_me() takes 0 positional arguments but 2 were given.

Is there an alternative way to get and set a vtkMRMLSequenceBrowserNode current frame without creating an observer? Or am I doing something else wrong to give me this error?

My sequence browser is observing 2 synchronized sequence nodes (using sequenceBrowser.AddSynchronizedSequenceNodeID()), if this matters.

I was able to get and set the frame/timepoint using the following, and did not get any errors

#Get current frame
current_frame = browserNode.GetSelectedItemNumber()
#Set frame 
new_frame = 5
browserNode.SetSelectedItemNumber(new_frame)
1 Like