[vtkusers] wxPython and VTK

REGAT-BARREL Aurélien arbvtk at yahoo.fr
Tue Jan 27 07:46:25 EST 2004


Hello Torsten,
You're right, the problem only appears if I try to view something. If I only create an empty VTKRenderWindow there is no problem. So, deleting the objects before exit is a very good idea. I tried and...it seems to work!
 
from wxPython.wx import *
from vtkpython import *
def Test():
    #wxWindows stuff
    app = wxPySimpleApp()
    frame = wxFrame(None, -1, "wxRenderWindow", size=wxSize(400,400))
    #VTK stuff
    renWin = vtkRenderWindow()
    ren = vtkRenderer()
    renWin.AddRenderer(ren)
    cone = vtkConeSource()
    cone.SetResolution(8)
    coneMapper = vtkPolyDataMapper()
    coneMapper.SetInput(cone.GetOutput())
    coneActor = vtkActor()
    coneActor.SetMapper(coneMapper)
    ren.AddActor(coneActor)
    #bind
    renWin.SetWindowInfo(str(frame.GetHandle()))
    #watch
    frame.Show(1)
    renWin.Render()
    app.MainLoop()
    #clean
    ren.RemoveAllProps()
 
if __name__ == "__main__":
    Test()

Thank you very much for this tip. I have to do a demonstration of my work in 1h so if I can quickly solve my crash on exit problem it is wonderfull.
I will have a deeper look at this problem later and I will try to update wxVTKRenderWindow.py because it is very anoying.
Thanks a lot.
 
Aurélien REGAT-BARREL

Torsten Sadowski <moehl at akaflieg.extern.tu-berlin.de> wrote:
I had the same problem. It is Windows(MS not WX) related and might be a
OpenGL problem. the solution for me was to add

def __del__(self):
self.renderer.GetProps().RemoveAllItems()

to my subclass of wxVTKRenderWindow.

Torsten

On Tue, 27 Jan 2004, REGAT-BARREL Aurélien wrote:

> Hello,
> I'm using VTK 4.2 with Python 2.3 and wxWindows (wxPython) under Windows.
> Problem : wxVTKRenderWindow crashes on exit (fatal error on python.exe). wxPython doesn't like VTK.



---------------------------------
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Testez le nouveau Yahoo! Mail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040127/255d3251/attachment.htm>


More information about the vtkusers mailing list