]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxVTKRenderWindow.py
Some additions to the 12-bit patch.
[wxWidgets.git] / wxPython / demo / wxVTKRenderWindow.py
1
2 from wxPython.wx import *
3 try:
4 from wxPython.lib import vtk
5 haveVTK = true
6 except ImportError:
7 haveVTK = false
8
9 #----------------------------------------------------------------------
10
11 def MakeCone(vtkwin):
12 cone = vtk.vtkConeSource()
13 cone.SetResolution(80)
14 coneMapper = vtk.vtkPolyDataMapper()
15 coneMapper.SetInput(cone.GetOutput())
16 coneActor = vtk.vtkActor()
17 coneActor.SetMapper(coneMapper)
18
19 ren = vtk.vtkRenderer()
20 vtkwin.GetRenderWindow().AddRenderer(ren)
21 ren.AddActor(coneActor)
22
23
24 #----------------------------------------------------------------------
25
26 def runTest(frame, nb, log):
27 if haveVTK:
28 f = wxFrame(frame, -1, "wxVTKRenderWindow", size=(450, 300),
29 style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
30 win = vtk.wxVTKRenderWindow(f, -1)
31 MakeCone(win)
32
33 f.Show(true)
34 frame.otherWin = f
35 return None
36
37
38 else:
39 wxMessageBox("Unable to import VTK, which is a required component\n"
40 "of this demo. You need to download and install the\n"
41 "Python extension module for VTK from http://www.kitware.com/",
42 "Import Error")
43 return None
44
45 #----------------------------------------------------------------------
46
47
48 overview = """\
49 wxVTKRenderWindow is a wrapper around the vtkRenderWindow from the
50 VTK Visualization Toolkit. The VTK Python extensions are required,
51 they can be obtained from http://www.kitware.com/ where you can also
52 find some nifty pictures and stuff.
53
54 """