[vtk-developers] Overriding MouseButtonPressEvent in vtkChartXY

Marcus D. Hanwell marcus.hanwell at kitware.com
Tue May 10 10:05:58 EDT 2016


On Mon, May 9, 2016 at 2:32 PM, Brad Hollister <behollis at sci.utah.edu> wrote:
> So, I've used the AddObserver method on vtkObject to register a callback.
> There is a Python example of this:
>
> http://www.vtk.org/Wiki/VTK/Examples/Python/Interaction/MouseEventsObserver
>
> However, I want to specifically handle a 'LeftButtonPressEvent' on a
> vtkChartXY object. If I invoke an event as in:
>
> self.chart.InvokeEvent('LeftButtonPressEvent')
>
> this event will be caught by my handler function. However, a
> 'LeftButtonPressEvent' when invoked on the graphical widget doesn't call the
> handler.
>
> Some events, which are labelled 'NoEvent' or 'InteractionEvent', will invoke
> a call on my callback, such as a scroll wheel event outside the content in
> the vtkChartXY view.
>
> Is there still a way to handle a 'LeftButtonPressEvent' that appears to stop
> at vtkChartXY handler level? Does vtkChartXY emit a signal after having
> processed an event, that can be subsequently handled by a user-defined
> routine in Python?
>
Not to my knowledge, I don't think we ever really went down this path
with the events in the charts framework. We never worked on ways to
support Python derived chart objects - the chart objects do not emit
many events.

What would be the expected behavior here? The chart would still do
whatever it does with the event, but then you want some to do
something extra? Which objects are you expecting to emit events - the
chart, the plot, the interactor, ? Not much of that is in place at the
present time.

Marcus


More information about the vtk-developers mailing list