[vtkusers] [VTK4.x + Python + wxPhyton] wxVTKRenderWindow maturity

David Gobbi dgobbi at irus.rri.ca
Wed Feb 27 06:47:50 EST 2002


Hi Eric,

Thanks for the tests.  I've patched the VTK 4.0 wxVTKRenderWindow so that
it should work fine in a notebook or a splitter under Linux.  It was the
SetWindowInfo() before wxWindow creation problem.  When I originally
wrote the class I had hoped that I could force creation of the
wxVTKRenderWindow's parent wxWindow within the __init__() before the
SetWindowInfo() was called (that's what all the p.Show(1) stuff is about).
Apparently I was wrong, as your tests demonstrated.

As for the testSideBySide.py, the problems go away if you use a Sizer:
frame.SetSizer(wxBoxSizer(wxHORIZONTAL))
frame.GetSizer().Add(wxvtk1, 1, wxEXPAND)
frame.GetSizer().Add(wxvtk2, 1, wxEXPAND)
frame.Layout()


Getting the wxVTKRenderWindow to work perfectly under both Windows and
Linux is not an easy task.  There are several issues, primarily because
1) wxMSW and wxGTK are very different from each other in many significant
   ways, including the way that window leave/enter events are handled,
   the way resize & paint events are handled, and many other things
2) the wxGTK code base isn't very stable, huge changes seem to happen in
   the code with each minor release which makes it hard to work around
   any wxGTK bugs
3) the SetWindowInfo() trick that connects VTK-Python and wxPython is
   an ugly hack that only works if window creation and rendering occur
   in the correct order (this can very hard to guarantee).


The main issue is simply that wxWindows is not as mature as Tk, and
there's not much that we can do about that.

 - David

--
  David Gobbi, MSc                       dgobbi at irus.rri.ca
  Advanced Imaging Research Group
  Robarts Research Institute, University of Western Ontario

On Wed, 27 Feb 2002, Eric Boix wrote:

>         Dear VTK + Python + wxPython users,
>
>   I've been using the wxVTKRenderWindow (the plugin of a VTK RenderWindow for
> the wxPython portable GUI toolkit) for almost a year now. During this period
> I witnessed the evolution of this wxVTKRenderWindow class and even participated
> in testing it. At times, I could successfully use it for my medical
> imaging laboratory projects (see
>   http://www.creatis.insa-lyon.fr/~frog/wxVTKRenderWindow/wxVTKRenderWindow.png
> for a screenshot of what can be achieved with it).
>
>   Sadly enough I have to admit that today's versions didn't reach the maturity
> I was expecting. In particular it never reached the maturity of it's peer
> version for Tcl/TK.
>
>   One of the biggest difficulties comes from the various versions of
> wxVTKRenderWindow. To make a long story short, one can consider they are
> two main branches for this code :
>  * the first one developped by both Robin Dunn (who maintains wxPython and
>    wxWindows) and Prabhu Ramachandran. Those versions are the one packaged with
>    wxPython. The main reference is here :
>    http://cvs.wxwindows.org/cgi-bin/viewcvs.cgi/wxPython/wxPython/lib/vtk.py
>      Note that, depending on the version of wxPython you download, you will
>    obtain a very different version of wxVTKRenderWindow !
>  * the second one is due to David Gobbi with suggested improvement from
>    Prabhu Ramachandran. This version comes with VTK4.x. The main reference
>    is here :
>    http://public.kitware.com/cgi-bin/cvsweb.cgi/VTK/Wrapping/Python/wxVTKRenderWindow.py?cvsroot=VTK
>
>   In an ditch attemp to decide which version to use, I built a small low level
> testing suite for the various versions of this wxVTKRenderWindow class.
> Basically it checks if the immersion of one (or many) wxVTKRenderWindow in
> some simple wxPython widgets (like a frame, a notebook, a splitterwindow)
> is operationnal.
>
> You can find the result of this minimal test suite for the above mentioned
> versions at
>    http://www.creatis.insa-lyon.fr/~frog/wxVTKRenderWindow/Tests.txt
> My conclusion and IMVHO is that none of those versions seem to work fully and
> properly on both Win32 and Un*x. I wish I was wrong (maybe my testing scripts
> are plain crap)...
>
> This test suite can be retrieved at
>   http://www.creatis.insa-lyon.fr/~frog/wxVTKRenderWindow/
> with the following layout
>   * the test scripts are the files test*.py,
>   * the various wxVTKRenderWindow versions are the files vtk*.py
>   * a switch script __init__.py (comment out what you need) with
>     some comments on the vtk*.py.
>
> You can also retrieve this context in a single gzipped tar file at
>   http://www.creatis.insa-lyon.fr/~frog/wxVTKRenderWindow/wxVTKRenderWindow.tgz
> Once downloaded you can directely run any of the scripts by invoking python
> on them e.g. python testSplitter.py. Switching the version is done by
> editing __init__.py.
>
>
> I can now dare to ask my questions :
>  * what branch/version do the Python+VTK gurus recommend ?
>  * what is the best strategy to achieve maturity with wxVTKRenderWindow ?
>
> Needless to say I offer my services, to whom may need them, for testing the
> incoming versions before reaching the golden age of stability.
>
>         Yours,
>         Eric Boix.
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>





More information about the vtkusers mailing list