]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/wxVTKRenderWindow.py
corrected assert even better
[wxWidgets.git] / wxPython / demo / wxVTKRenderWindow.py
index df1a710d0fe50b3e158d498fc6f32b40f74775c5..520f50b2aa3d97f94794ab3610eb147adeb45c6a 100644 (file)
@@ -8,36 +8,27 @@ except ImportError:
 
 #----------------------------------------------------------------------
 
+def MakeCone(vtkwin):
+    cone = vtk.vtkConeSource()
+    cone.SetResolution(80)
+    coneMapper = vtk.vtkPolyDataMapper()
+    coneMapper.SetInput(cone.GetOutput())
+    coneActor = vtk.vtkActor()
+    coneActor.SetMapper(coneMapper)
+
+    ren = vtk.vtkRenderer()
+    vtkwin.GetRenderWindow().AddRenderer(ren)
+    ren.AddActor(coneActor)
+
+
+#----------------------------------------------------------------------
+
 def runTest(frame, nb, log):
     if haveVTK:
-        f = wxFrame(frame, -1, "wxVTKRenderWindow", size=(450, 300))
+        f = wxFrame(frame, -1, "wxVTKRenderWindow", size=(450, 300),
+                    style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
         win = vtk.wxVTKRenderWindow(f, -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)
+        MakeCone(win)
 
         f.Show(true)
         frame.otherWin = f