[vtkusers] UserEvent being called twice

Mathieu Malaterre Mathieu.Malaterre at creatis.insa-lyon.fr
Tue Oct 21 11:25:54 EDT 2003


Hi all,

	Could someone please try this python script(*). Just start it and press 
'u'. How come the first time the function 'foo' is being called two times ?

	I tried with other vtkCommand (CharEvent...), but only UserEvent seems 
to have this problem.

Thanks for your help
mathieu


(*)
import vtk

sphere = vtk.vtkSphereSource()

mapper = vtk.vtkPolyDataMapper()
mapper.SetInput(sphere.GetOutput())

actor = vtk.vtkActor()
actor.SetMapper(mapper)

ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
ren.AddActor(actor)

def foo(obj, event):
   print "bar"
   iren.GetInteractorStyle().SetCurrentStyleToTrackballCamera()

iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
iren.AddObserver("UserEvent", foo)
#iren.AddObserver("CharEvent", foo)

iren.Initialize()
iren.Start()




More information about the vtkusers mailing list