0% found this document useful (0 votes)
424 views2 pages

VTK Examples Python Animation - KitwarePublic

This Python script uses VTK to animate a sphere moving across the scene. A timer callback method is used to increment the sphere's position each frame. The renderer, window, and interactor are set up to display the scene. The timer is started to trigger the callback and animate the sphere moving.

Uploaded by

Manu Mannu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
424 views2 pages

VTK Examples Python Animation - KitwarePublic

This Python script uses VTK to animate a sphere moving across the scene. A timer callback method is used to increment the sphere's position each frame. The renderer, window, and interactor are set up to display the scene. The timer is started to trigger the callback and animate the sphere moving.

Uploaded by

Manu Mannu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

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

You might also like