[vtkusers] TimerEvents not fired while dragging mouse in vtkRenderWindow

Kolja Petersen petersenkolja at gmail.com
Mon Nov 13 15:21:15 EST 2017


Heya,
I paste some code below, which displays an empty vtkRenderWindow with an
interactor. The interactor fires a TimerEvent every 100ms as printed by the
Observer.
The problem: as long as I press a mouse button in the vtkRenderWindow, the
TimerEvents stop to be reported, although I need to process data
periodically in my application as a reaction to those TimerEvents.

Why are no TimerEvents fired while a button is pressed, and how can I
change this behaviour?
Thank you
Kolja

import vtk

class Observer(object):
  def __init__(self):
    self.cnt=0
  def __call__(self,caller,evt):
    self.cnt+=1
    print "count %d %s" % (self.cnt,evt)

ren1 = vtk.vtkRenderer()
ren1.SetBackground(0.1, 0.2, 0.4)

renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
renWin.SetSize(300, 300)

iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)

style = vtk.vtkInteractorStyleTrackballCamera()
iren.SetInteractorStyle(style)

iren.Initialize()
observer=Observer()
iren.AddObserver(vtk.vtkCommand.TimerEvent,observer)
iren.AddObserver(vtk.vtkCommand.MouseMoveEvent,observer)
iren.AddObserver(vtk.vtkCommand.InteractionEvent,observer)
iren.CreateRepeatingTimer(100)
iren.Start()

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virenfrei.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20171113/27bc4f64/attachment.html>


More information about the vtkusers mailing list