]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/wxVTKRenderWindow.py
correction for Mac OS X compilation
[wxWidgets.git] / wxPython / demo / wxVTKRenderWindow.py
CommitLineData
e395c057
RD
1
2from wxPython.wx import *
3try:
4 from wxPython.lib import vtk
5 haveVTK = true
6except ImportError:
7 haveVTK = false
8
9#----------------------------------------------------------------------
10
286e2db6
RD
11def MakeCone(vtkwin):
12 cone = vtk.vtkConeSource()
7e3a5de3 13 cone.SetResolution(80)
286e2db6
RD
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
e395c057
RD
26def runTest(frame, nb, log):
27 if haveVTK:
286e2db6
RD
28 f = wxFrame(frame, -1, "wxVTKRenderWindow", size=(450, 300),
29 style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
54b96882 30 win = vtk.wxVTKRenderWindow(f, -1)
286e2db6 31 MakeCone(win)
e395c057 32
54b96882
RD
33 f.Show(true)
34 frame.otherWin = f
35 return None
e395c057
RD
36
37
38 else:
8e425133
RD
39 wxMessageBox("Unable to import VTK, which is a required component\n"
40 "of this demo. You need to download and install the\n"
e395c057
RD
41 "Python extension module for VTK from http://www.kitware.com/",
42 "Import Error")
43 return None
44
45#----------------------------------------------------------------------
46
47
48overview = """\
49wxVTKRenderWindow is a wrapper around the vtkRenderWindow from the
50VTK Visualization Toolkit. The VTK Python extensions are required,
51they can be obtained from http://www.kitware.com/ where you can also
52find some nifty pictures and stuff.
53
54"""