[vtkusers] custom renderwindowinteractorstyle

Florian Bruckner e0425375 at gmail.com
Thu Sep 1 11:16:36 EDT 2011


ok, sounds easy, but i didn't get it running with python.

i tryied the following, but the new function is never called:
    class InteractorStyleNew(vtk.vtkInteractorStyleTrackballCamera):
          def OnLeftButtonUp(self):
                  print "Middle Button Pressed"

seaching the net i found some other solutions:
1.) http://vtk.org/gitweb?p=VTK.git;a=blob;f=Examples/GUI/Python/CustomInteraction.py
2.) http://code.google.com/p/vtkpythonext/source/browse/trunk/spare/src/jolly/jolly_vtk2/vtkPythonInteractorStyle.py?r=35

but they are not as beautiful as the method used in the c++ example.


is there an obvious error in my example, which i cannot see, or is
there a problem with the python support?

greetings
Florian


On Thu, Sep 1, 2011 at 3:38 PM, David Doria <daviddoria at gmail.com> wrote:
> On Thu, Sep 1, 2011 at 9:30 AM, Florian Bruckner <e0425375 at gmail.com> wrote:
>> hi,
>>
>> how is it possible to write an custom RenderWindowInteractorStyle
>> which does exactly the same as vtkInteractorStyleTrackballCamera, but
>> which does not react on the zoom event. only panning and rotation
>> should be allowed.
>>
>> thanks
>> Florian
>
> You have to create a subclass of the interactor style. Then in the
> appropriate action (in this case something like OnMiddleButtonDown()
> ), do whatever you want (in this case nothing). Here is an example of
> the structure:
>
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Interaction/MouseEvents
>
> David
>



More information about the vtkusers mailing list