]>
Commit | Line | Data |
---|---|---|
e395c057 RD |
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 | ||
286e2db6 RD |
11 | def 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 |
26 | def 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 | ||
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 | """ |