1999-11-19 00:34:40 -05:00
|
|
|
|
|
|
|
from wxPython.wx import *
|
|
|
|
try:
|
|
|
|
from wxPython.lib import vtk
|
|
|
|
haveVTK = true
|
|
|
|
except ImportError:
|
|
|
|
haveVTK = false
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
2001-07-06 00:11:34 -04:00
|
|
|
def MakeCone(vtkwin):
|
|
|
|
cone = vtk.vtkConeSource()
|
2001-07-06 13:35:48 -04:00
|
|
|
cone.SetResolution(80)
|
2001-07-06 00:11:34 -04:00
|
|
|
coneMapper = vtk.vtkPolyDataMapper()
|
|
|
|
coneMapper.SetInput(cone.GetOutput())
|
|
|
|
coneActor = vtk.vtkActor()
|
|
|
|
coneActor.SetMapper(coneMapper)
|
|
|
|
|
|
|
|
ren = vtk.vtkRenderer()
|
|
|
|
vtkwin.GetRenderWindow().AddRenderer(ren)
|
|
|
|
ren.AddActor(coneActor)
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
1999-11-19 00:34:40 -05:00
|
|
|
def runTest(frame, nb, log):
|
|
|
|
if haveVTK:
|
2001-07-06 00:11:34 -04:00
|
|
|
f = wxFrame(frame, -1, "wxVTKRenderWindow", size=(450, 300),
|
|
|
|
style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
|
1999-12-29 17:10:32 -05:00
|
|
|
win = vtk.wxVTKRenderWindow(f, -1)
|
2001-07-06 00:11:34 -04:00
|
|
|
MakeCone(win)
|
1999-11-19 00:34:40 -05:00
|
|
|
|
1999-12-29 17:10:32 -05:00
|
|
|
f.Show(true)
|
|
|
|
frame.otherWin = f
|
|
|
|
return None
|
1999-11-19 00:34:40 -05:00
|
|
|
|
|
|
|
|
|
|
|
else:
|
2000-01-19 01:58:56 -05:00
|
|
|
wxMessageBox("Unable to import VTK, which is a required component\n"
|
|
|
|
"of this demo. You need to download and install the\n"
|
1999-11-19 00:34:40 -05:00
|
|
|
"Python extension module for VTK from http://www.kitware.com/",
|
|
|
|
"Import Error")
|
|
|
|
return None
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
overview = """\
|
|
|
|
wxVTKRenderWindow is a wrapper around the vtkRenderWindow from the
|
|
|
|
VTK Visualization Toolkit. The VTK Python extensions are required,
|
|
|
|
they can be obtained from http://www.kitware.com/ where you can also
|
|
|
|
find some nifty pictures and stuff.
|
|
|
|
|
|
|
|
"""
|