11/24/2014
VTK/Examples/Python/AnimationKitwarePublic
VTK/Examples/Python/Animation
FromKitwarePublic
<VTK|Examples|Python
Thisexampleusesatimertomoveasphereacrossascene.
Contributedby:BryanConrad
[Link]
importvtk
classvtkTimerCallback():
def__init__(self):
self.timer_count=0
defexecute(self,obj,event):
printself.timer_count
[Link](self.timer_count,self.timer_count,0);
iren=obj
[Link]().Render()
self.timer_count+=1
defmain():
#Createasphere
sphereSource=[Link]()
[Link](0.0,0.0,0.0)
[Link](5)
#Createamapperandactor
mapper=[Link]()
[Link]([Link]())
actor=[Link]()
[Link](mapper)
prop=[Link]()
#Setuparenderer,renderwindow,andinteractor
renderer=[Link]()
renderWindow=[Link]()
#[Link]("Test")
[Link](renderer);
renderWindowInteractor=[Link]()
[Link](renderWindow)
#Addtheactortothescene
[Link](actor)
[Link](1,1,1)#Backgroundcolorwhite
#Renderandinteract
[Link]()
[Link]
1/2
11/24/2014
VTK/Examples/Python/AnimationKitwarePublic
#Initializemustbecalledpriortocreatingtimerevents.
[Link]()
#SignuptoreceiveTimerEvent
cb=vtkTimerCallback()
[Link]=actor
[Link]('TimerEvent',[Link])
timerId=[Link](100);
#starttheinteractionandtimer
[Link]()
if__name__=='__main__':
main()
Retrievedfrom"[Link]
Thispagewaslastmodifiedon6January2010,at18:57.
ContentisavailableunderAttribution2.5.
[Link]
2/2