[vtkusers] Mouse wheel events not working with vtkInteractorStyleUser

Elvis Stansvik elvis.stansvik at orexplore.com
Fri Jun 17 10:28:54 EDT 2016


2016-06-17 15:51 GMT+02:00 Cory Quammen <cory.quammen at kitware.com>:

> Elvis,
>
> It would be great if you could create a merge request on gitlab! And
> once you do, don't be afraid to bug us to take a look.
>

Thanks Cory, the merge request is here:

    https://gitlab.kitware.com/vtk/vtk/merge_requests/1577

Have a nice weekend,
Elvis


> Contributing guidelines are here:
>
> https://gitlab.kitware.com/vtk/vtk/blob/master/CONTRIBUTING.md
>
> Cory
>
> On Fri, Jun 17, 2016 at 2:44 PM, Elvis Stansvik
> <elvis.stansvik at orexplore.com> wrote:
> > 2016-06-17 12:43 GMT+02:00 Elvis Stansvik <elvis.stansvik at orexplore.com
> >:
> >>
> >> Hi all,
> >>
> >> From what I've read, vtkInteractorStyleUser is still the canonical way
> to
> >> do completely custom interaction behavior from Python, by observing the
> >> events of the interactor.
> >>
> >> But running this minimal test case:
> >>
> >> from vtk import vtkRenderWindow
> >> from vtk import vtkRenderWindowInteractor
> >> from vtk import vtkInteractorStyleUser
> >> from vtk import vtkCommand
> >>
> >> def onLeftButtonPressEvent(sender, event):
> >>     print('left button press')
> >>
> >> def onMouseWheelForwardEvent(sender, event):
> >>     print('wheel forward')
> >>
> >> interactorStyle = vtkInteractorStyleUser()
> >>
> >> interactorStyle.AddObserver(
> >>     vtkCommand.LeftButtonPressEvent,
> >>     onLeftButtonPressEvent)
> >>
> >> interactorStyle.AddObserver(
> >>     vtkCommand.MouseWheelForwardEvent,
> >>     onMouseWheelForwardEvent)
> >>
> >> renderWindow = vtkRenderWindow()
> >>
> >> interactor = vtkRenderWindowInteractor()
> >> interactor.SetRenderWindow(renderWindow)
> >> interactor.SetInteractorStyle(interactorStyle)
> >> interactor.Start()
> >>
> >> It seems that wheel events are not supported by vtkInteractorStyleUser?
> >> Scrolling the wheel forwards prints nothing, while pressing the left
> mouse
> >> button prints "left button press" as expected.
> >
> >
> > I'm starting to think that this is simply an accidental omission in
> > vtkInteractorStyleUser. Would you accept a patch to add support for
> > MouseWheelForwardEvent and MouseWheelBackwardEvent?
> >
> > Elvis
> >
> >>
> >> What should I do if I want to provide completely custom interaction from
> >> Python, and still be able to handle wheel events?
> >>
> >> Thanks in advance,
> >> Elvis
> >>
> >
> >
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the VTK FAQ at:
> > http://www.vtk.org/Wiki/VTK_FAQ
> >
> > Search the list archives at: http://markmail.org/search/?q=vtkusers
> >
> > Follow this link to subscribe/unsubscribe:
> > http://public.kitware.com/mailman/listinfo/vtkusers
> >
>
>
>
> --
> Cory Quammen
> R&D Engineer
> Kitware, Inc.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160617/3a0bf9d8/attachment.html>


More information about the vtkusers mailing list