[vtkusers] wxVTKRenderWindow freezes on Windows XP

Marcus Stojek stojek at part-gmbh.de
Wed Oct 30 09:02:16 EST 2002


Hi,

I'm using wxPython 2.3.3.1, Python 2.2.1 and vtk 4.0 on Windows NT.
The little example program below is a minimal viewer for vtk ASCII files
(vtk DataFile Version 4.0, DATASET UNSTRUCTURED_GRID).

On Windows NT and 2000 everything works fine. On XP the Renderwindow (and
the
app) freezes with some vtk files and works fine with others. (I can mail two
examples 129k) It's always the same vtk file that's crashing.
Is there any known problem with XP, or could anybody give me a hint?

--snip----------------------------------------------------------------------
--------
from wxPython.wx import *
import os
from vtk import *
import wxVTKRenderWindow
#----------------------------------------------------------------------
class MyParentFrame(wxMDIParentFrame):
    def __init__(self):
        wxMDIParentFrame.__init__(self, None, -1, "Viewer", size=(600,400))
        self.cwd = os.getcwd()
        self.winCount = 0
        menu = wxMenu()
        menu.Append(5000, "&New Window")
        menu.AppendSeparator()
        menu.Append(5001, "E&xit")

        menubar = wxMenuBar()
        menubar.Append(menu, "&File")
        self.SetMenuBar(menubar)

        self.CreateStatusBar()

        EVT_MENU(self, 5000, self.OnNewWindow)
        EVT_MENU(self, 5001, self.OnExit)
#--------------------------------------------
    def OnExit(self, evt):
        self.Close(true)
#--------------------------------------------
    def OnNewWindow(self, evt):
        dlg = wxFileDialog(self, "Select vtk file",self.cwd,
                           "*.vtk", "vtk ASCII file |*.vtk", wxOPEN)
        if dlg.ShowModal() == wxID_OK:
            filename=dlg.GetPath()
            dlg.Destroy()
        else:
            dlg.Destroy()
            return 0
        vtkbase,vtkext=os.path.splitext(filename)
        vtkdir,vtkfilename=os.path.split(vtkbase)

        win = wxMDIChildFrame(self, -1, vtkfilename)
        widget = wxVTKRenderWindow.wxVTKRenderWindow(win, -1)

        reader = vtkUnstructuredGridReader()
        reader.SetFileName(filename)
        MapperSurf=vtkDataSetMapper()
        MapperSurf.SetInput(reader.GetOutput())
        MapperSurf.ScalarVisibilityOff()
        ActorSurf=vtkActor()
        ActorSurf.SetMapper(MapperSurf)
        PropSurf=vtkProperty()
        PropSurf.SetDiffuseColor(0.7,0.7,0.7)
        PropSurf.SetAmbientColor(0.7,0.7,0.7)
        PropSurf.SetRepresentationToSurface()
        PropSurf.BackfaceCullingOff()
        PropSurf.FrontfaceCullingOff()
        ActorSurf.SetProperty(PropSurf)

        ren = vtkRenderer()
        widget.GetRenderWindow().AddRenderer(ren)
        ren.AddActor(ActorSurf)

        widget.Render()
        widget.Show(true)
#----------------------------------------------------------------------
class MyApp(wxApp):
    def OnInit(self):
        frame = MyParentFrame()
        frame.Show(true)
        self.SetTopWindow(frame)
        return true
#--------------------------------------------
#--------------------------------------------
app = MyApp(0)
app.MainLoop()
--snip----------------------------------------------------------------------
--------







More information about the vtkusers mailing list