After further investigation I managed by
- adding an observer on
CharEvent
with higher priority than the one that is in the interactor. Earlier I usedKeyPressEvent
which was not correct. - modifying the key code of the event. I set it to no character to be absolutely sure
def consumeCharEvent(interactor, event):
if interactor.GetKeyCode() in ['s', 'w']:
interactor.SetKeyCode("")
iren = vtk.vtkRenderWindowInteractor()
iren.AddObserver("CharEvent", consumeCharEvent, 10)
To make it a clean job I would like to be able to get the priority of the CharEvent
observer I want to override. I do not seem to find a way to get any observers from a vtkObject
, but printing the object (the interactor) I can find the observer priority and tag.
vtkObserver (000001F012EB9910)
Event: 22
EventName: CharEvent
Command: 000001F012ECA480
Priority: 0
Tag: 81
Any help is welcome
Edo