]>
git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/demo/wxVTKRenderWindow.py
2 from wxPython
.wx
import *
4 from wxPython
.lib
import vtk
9 #----------------------------------------------------------------------
11 def runTest(frame
, nb
, log
):
13 win
= vtk
.wxVTKRenderWindow(nb
, -1)
15 # Get the render window
16 renWin
= win
.GetRenderWindow()
18 # Next, do the VTK stuff
19 ren
= vtk
.vtkRenderer()
20 renWin
.AddRenderer(ren
)
21 cone
= vtk
.vtkConeSource()
22 cone
.SetResolution(80)
23 coneMapper
= vtk
.vtkPolyDataMapper()
24 coneMapper
.SetInput(cone
.GetOutput())
25 coneActor
= vtk
.vtkActor()
26 coneActor
.SetMapper(coneMapper
)
27 ren
.AddActor(coneActor
)
28 coneMapper
.GetLookupTable().Build()
31 scalarBar
= vtk
.vtkScalarBarActor()
32 scalarBar
.SetLookupTable(coneMapper
.GetLookupTable())
33 scalarBar
.SetTitle("Temperature")
34 scalarBar
.GetPositionCoordinate().SetCoordinateSystemToNormalizedViewport()
35 scalarBar
.GetPositionCoordinate().SetValue(0.1, 0.01)
36 scalarBar
.SetOrientationToHorizontal()
37 scalarBar
.SetWidth(0.8)
38 scalarBar
.SetHeight(0.17)
39 ren
.AddActor2D(scalarBar
)
45 wxMessageBox("Unable to import VTK, which is a required component "
46 "of this demo. You need to download and install the "
47 "Python extension module for VTK from http://www.kitware.com/",
51 #----------------------------------------------------------------------
55 wxVTKRenderWindow is a wrapper around the vtkRenderWindow from the
56 VTK Visualization Toolkit. The VTK Python extensions are required,
57 they can be obtained from http://www.kitware.com/ where you can also
58 find some nifty pictures and stuff.