[vtkusers] Problem with picking and wxVTKRenderWindow.py

Philou la loutre philoulaloutre at free.fr
Fri Nov 26 05:09:01 EST 2004


Hello

I try to use a picker with a wxVTKRenderWindow on Python. But i don't understand
how it works :((
When I press the key 'p', the procedure 'PickActor' is called but it's
impossible for me to pick the Actor unfortunately...
Here is some very basics changes i have done to this procedure in order to
explain my problem :

def PickActor(self,event):
        if self._CurrentRenderer:
            x = event.GetX()
            y = event.GetY()

            renderer = self._CurrentRenderer
            picker = self._Picker

            windowX, windowY = self._RenderWindow.GetSize()
            picker.Pick(x,(windowY - y - 1),0.0,renderer)
            actor = picker.GetActor()

            if (self._PickedActor != None and
                self._PrePickedProperty != None):
                self._PickedActor.SetProperty(self._PrePickedProperty)
                # release hold of the property
                self._PrePickedProperty.UnRegister(self._PrePickedProperty)
                self._PrePickedProperty = None

            if (actor != None):
                self._PickedActor = actor
                self._PrePickedProperty = self._PickedActor.GetProperty()
                # hold onto the property
                self._PrePickedProperty.Register(self._PrePickedProperty)
                self._PickedActor.SetProperty(self._PickedProperty)
                EVT_RIGHT_DOWN(self, NULL)
            else:
                EVT_LEFT_DOWN(self, NULL)

            self.Render()

I have just added the lines :

EVT_RIGHT_DOWN(self, NULL)
else:
EVT_LEFT_DOWN(self, NULL)

I should disable right mouse button when I pick the actor and left mouse button
when I pick the renderWindow everywhere else. But the button which is allways
disabled is the left mouse button even if I pick the Cone Actor.

Finally, I would like to do the same for wxVTKRenderWindowInteractor.py but I
think to begin with wxVTKRenderWindow as a more simple example.

Can someone help me? Can someone use embeded vtkRenderWindow in wxPython with
picking action enabled on linux system?

I work on linux Red Hat 8.0 with Python 2.3.3, wxPython 2.4.2.4 and vtk 4.2

Thanks for your help
Philippe Verney



More information about the vtkusers mailing list