X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5008c64c321c39b498bbe5fb7f8bcc667cd41fe2..e395c057a357ea8e8fb54a161897e6c4fb27266d:/utils/wxPython/demo/wxVTKRenderWindow.py?ds=sidebyside diff --git a/utils/wxPython/demo/wxVTKRenderWindow.py b/utils/wxPython/demo/wxVTKRenderWindow.py new file mode 100644 index 0000000000..eed4fd22e3 --- /dev/null +++ b/utils/wxPython/demo/wxVTKRenderWindow.py @@ -0,0 +1,60 @@ + +from wxPython.wx import * +try: + from wxPython.lib import vtk + haveVTK = true +except ImportError: + haveVTK = false + +#---------------------------------------------------------------------- + +def runTest(frame, nb, log): + if haveVTK: + win = vtk.wxVTKRenderWindow(nb, -1) + + # Get the render window + renWin = win.GetRenderWindow() + + # Next, do the VTK stuff + ren = vtk.vtkRenderer() + renWin.AddRenderer(ren) + cone = vtk.vtkConeSource() + cone.SetResolution(80) + coneMapper = vtk.vtkPolyDataMapper() + coneMapper.SetInput(cone.GetOutput()) + coneActor = vtk.vtkActor() + coneActor.SetMapper(coneMapper) + ren.AddActor(coneActor) + coneMapper.GetLookupTable().Build() + + # Create a scalar bar + scalarBar = vtk.vtkScalarBarActor() + scalarBar.SetLookupTable(coneMapper.GetLookupTable()) + scalarBar.SetTitle("Temperature") + scalarBar.GetPositionCoordinate().SetCoordinateSystemToNormalizedViewport() + scalarBar.GetPositionCoordinate().SetValue(0.1, 0.01) + scalarBar.SetOrientationToHorizontal() + scalarBar.SetWidth(0.8) + scalarBar.SetHeight(0.17) + ren.AddActor2D(scalarBar) + + return win + + + else: + wxMessageBox("Unable to import VTK, which is a required component " + "of this demo. You need to download and install the " + "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. + +"""