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