[wxPython] initializing of wxVTKRenderWindow

Hi,

I am using David Gobbis VTK RenderWindow and everything works just
fine. Since I am using the GridReader the RenderWindow comes up
but doesn't show anything until I resize the Window. Then the model
comes up. As you can see I refreshed everything that can be refreshed
but still nothing happens. Any ideas ?

Thanks in advance,
Marcus

#--snip----
        self.f = wxFrame(self.parent,-1,title = 'test', pos = wpos,size=
wsize,

style=wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxNO_FULL_REPAINT_ON_RESIZE,name
="frame")
        filename='test.vtk'
        self.reader = vtk.vtkUnstructuredGridReader()
        self.reader.SetFileName(filename)

        self.MapperSurf=vtk.vtkDataSetMapper()
        self.MapperSurf.SetInput(self.reader.GetOutput())
        self.MapperSurf.ScalarVisibilityOff()

        self.ActorSurf=vtk.vtkActor()
        self.ActorSurf.SetMapper(self.MapperSurf)

        self.PropSurf=vtk.vtkProperty()
        self.PropSurf.SetDiffuseColor(0.7,0.7,0.7)
        self.PropSurf.SetAmbientColor(0.7,0.7,0.7)
        self.PropSurf.SetRepresentationToSurface()
        self.PropSurf.BackfaceCullingOff()
        self.PropSurf.FrontfaceCullingOff()
        self.ActorSurf.SetProperty(self.PropSurf)

        self.ren = vtk.vtkRenderer()
        self.win=wxVTKRenderWindow(self.f,-1,stereo=0)
        self.win.GetRenderWindow().AddRenderer(self.ren)
        self.ren.AddActor(self.ActorSurf)

        self.win.Render()
        self.f.Show(true)
        self.f.Refresh()
        self.win.Refresh(eraseBackground=FALSE)
#--snip----

I am using David Gobbis VTK RenderWindow and everything works just
fine. Since I am using the GridReader the RenderWindow comes up
but doesn't show anything until I resize the Window. Then the model
comes up. As you can see I refreshed everything that can be refreshed
but still nothing happens. Any ideas ?

Whenever something "works" only after the first resize you can usually fix
it by delaying setting the size of the window until all the children have
been created.

#--snip----
        self.f = wxFrame(self.parent,-1,title = 'test', pos = wpos,size=
wsize,

style=wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxNO_FULL_REPAINT_ON_RESIZE,name

="frame")

For example, take out the "size=wsize" above and add self.f.SetSize(wsize)
at the end.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!