[vtkusers] wxPython and VTK

Mathieu Malaterre mathieu.malaterre at kitware.com
Tue Jan 27 10:09:47 EST 2004


Aurélien,

	You shouldn't be doing something particular for Windows. I recently 
commited a patch for that -or I believe so-. Could you do me a favor, 
could you please try it instead of the

	'self.renderer.GetProps().RemoveAllItems()'

	Go to that web page, it works just like a patch :

http://vtk.org/cgi-bin/cvsweb.cgi/VTK/Rendering/vtkWin32OpenGLRenderWindow.cxx.diff?r1=1.121&r2=1.122

	And just apply the same modification to your local VTK build tree. (you 
don't need a particular revision of vtkWin32OpenGLRenderWindow.cxx).

Thanks a bunch
Mathieu

REGAT-BARREL Aurélien wrote:
> 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 <http://fr.mail.yahoo.com>






More information about the vtkusers mailing list