scene.setSize() scene.setBackgroundColor(0,0,0) # render the scene scene.render(pause=True) # put an exit in here so that we don't run the vtk code sys.exit() # here is the original vtk code import vtk # set up the renderer and render window _renderer = vtk.vtkRenderer() _renderWindow = vtk.vtkRenderWindow() _renderWindow.AddRenderer(_renderer) _renderWindow.SetSize(1024,768) _renderer.SetBackground(0,0,0) # load the jpeg file _jpegReader = vtk.vtkJPEGReader() _jpegReader.SetFileName("Flinders_eval.jpg") # set the jpeg file to the texture _tex = vtk.vtkTexture() _tex.SetInput(_jpegReader.GetOutput()) # get the plane and add it to the "scene" _plane = vtk.vtkPlaneSource() _planeMapper = vtk.vtkPolyDataMapper()
_titleProp.ShallowCopy(_textProp) _titleProp.SetJustificationToCentered() _titleProp.SetVerticalJustificationToTop() _titleProp.SetColor(0,0,0) _titleProp.BoldOn() _titleProp.SetFontSize(20) # set up the text actor _titleActor = vtk.vtkTextActor() _titleActor.SetMapper(_titleMapper) _titleActor.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay() _titleActor.GetPositionCoordinate().SetValue(0.5, 0.95) # set up the renderer and the render window _ren = vtk.vtkRenderer() _renWin = vtk.vtkRenderWindow() _renWin.SetSize(640, 480) _renWin.AddRenderer(_ren) _ren.SetBackground(1,1,1) # add the actor _ren.AddActor(_actor) _ren.AddActor(_titleActor) # render the scene _iren = vtk.vtkRenderWindowInteractor() _iren.SetRenderWindow(_renWin) _iren.Initialize() _renWin.Render() _iren.Start()