[vtk-developers] Overriding MouseButtonPressEvent in vtkChartXY

Marcus D. Hanwell marcus.hanwell at kitware.com
Thu May 5 15:57:50 EDT 2016


On Wed, May 4, 2016 at 5:48 PM, Brad Hollister <behollis at sci.utah.edu> wrote:
> Hi,
>
> I'd like to override the mouse handler for vtkChartXY in Python. However,
> when I do this, the overriden function is not called. I have the following:
>
> from vtk import vtkChartXY, vtkContextMouseEvent
>
> class dbsTransFuncChart(vtkChartXY):
>     def __init__(self, parent =  None):
>         vtkChartXY.__init__(self)
>         self.par = parent
>
>     def MouseButtonPressEvent(self, *args, **kwargs):
>         self.par.updateRenderQVTKWin()
>         return vtkChartXY.MouseButtonPressEvent(self, *args, **kwargs)
>
> Is there a way to do this properly?
>
I am not sure on the right way to do this in Python, I don't remember
seeing examples of class derivation in Python using the VTK wrappers.
The equivalent should work in C++, hopefully someone who knows the
wrapping better might comment.

Marcus


More information about the vtk-developers mailing list