[vtkusers] [Python + wx] pb with wxVTKRenderWindow

Benoit Regrain benoit.regrain at creatis.insa-lyon.fr
Thu Oct 3 05:24:20 EDT 2002


I believe I might have found two bugs in the class wxVTKRenderWindow
as encountered in VTK/Wrapping/Python/vtk/wx/wxVTKRenderWindow.py.
I am working on Windows 2000 with the VTKNightly dated 10/02/2002.

 - At launch of the script wxVTKRenderWindow.py, a window appears, but
   nothing is displayed inside. Things become correct when I resize the
   window. (This was also reported by Chandra Shekhar, see
    http://public.kitware.com/pipermail/vtkusers/2002-October/013700.html)
   I could fix this problem, by changing the line 164 by :
         try:
             size = parent.GetSize()
         except:
             size = wxDefaultSize
   The try/except is used to protect the call to parent.
 
 - When the script wxVTKRenderWindow.py is launched and when killing
   the window (by clicking on the window close button, the one with a
   cross at the upper right), I get the following error message in 
   the Python console :
         runtime error R6025
         - Pure virtual function call
   This odd/bad behavior desapears when I add the line :
         widget.GetRenderWindow().RemoveRenderer(ren)
   at the end of test script, just after the line containing the
   "MainLoop" function. But I think that the problem is in the class
   wxVTKRenderWindow : Renderers might be refered to after they have
   allready been deleted/gced.
   To address this problem one could handle the proper deconnection
   of the RenderWindow from it's renderer[s] by adding a destructor
   to the wxVTKRenderWindow class. The following does the job for me:

   def __del__(self):
        renderers = self._RenderWindow.GetRenderers()
        numRenderers = renderers.GetNumberOfItems()
        self._CurrentRenderer = None
        renderers.InitTraversal()
        for i in range(0,numRenderers):
            self.GetRenderWindow().RemoveRenderer(renderers.GetNextItem())

  
Thanks for considering those problems.
Greetings


Benoit Regrain
Ingénieur d'étude CNRS (Creatis)
email : regrain at creatis.insa-lyon.fr
INSA - Bâtiment Blaise Pascal
7 avenue Jean Capelle
69621 Villeurbanne Cedex

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20021003/30bbe46d/attachment.htm>


More information about the vtkusers mailing list