[vtkusers] How to setup a user-defined function with vtkInteractorStyle's u key?
henrikw at hgu.mrc.ac.uk
henrikw at hgu.mrc.ac.uk
Tue Apr 11 09:52:10 EDT 2006
Hi Aroosha,
I am fairly new to VTK but this is how I did it in python/VTK 4.2:
# normal rendering stuff
ren = vtkRenderer()
ren.SetBackground(0.0, 0.0, 0.0)
renWin.SetSize(800,800)
renWin = vtkRenderWindow()
renWin.AddRenderer(ren)
ren.SetRenderWindow(renWin)
iren = vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
# function to handle when the 'u' key is pressed
# you can call the function "handlekey" whatever you like
def handleKey(obj, event):
print 'Hello I am the user defined function'
# add the observer to your window
iren.AddObserver("UserEvent", handleKey)
cheers,
Henrik
> Dear All,
>
> Could anyone please point me to an example of how one should go about
> setting up a user-defined function which could be invoked by pressing
> the 'u' key in a vtkRenderWindowInteractor?
>
> Many thanks,
> Aroosha
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
More information about the vtkusers
mailing list