The Higher Education and Research forge

Home My Page Projects Code Snippets Project Openings MMD
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

d7e8923cf0afdfa811632eb1c4cbf5b580fab15a
1 #!/usr/bin/env python
3 import vtk
6 # arrow.py adapted from the C++ vtk examples and translated to python.
8 def main():
9     colors = vtk.vtkNamedColors()
11     arrowSource = vtk.vtkArrowSource()
12     # arrowSource.SetShaftRadius(0.01)
13     # arrowSource.SetTipLength(.9)
15     # Create a mapper and actor
16     mapper = vtk.vtkPolyDataMapper()
17     mapper.SetInputConnection(arrowSource.GetOutputPort())
18     actor = vtk.vtkActor()
19     actor.SetMapper(mapper)
21     # Visualize
22     renderer = vtk.vtkRenderer()
23     renderWindow = vtk.vtkRenderWindow()
24     renderWindow.SetWindowName("MMD")
25     renderWindow.AddRenderer(renderer)
26     renderWindowInteractor = vtk.vtkRenderWindowInteractor()
27     renderWindowInteractor.SetRenderWindow(renderWindow)
29     renderer.AddActor(actor)
30     renderer.SetBackground(colors.GetColor3d("MidnightBlue"))
32     renderWindow.Render()
33     renderWindowInteractor.Start()
36 if __name__ == "__main__":
37     main()