wxVTKRenderWindow* ported to new wx namespace

Hi all,

    sorry for cross-posting in 2 mailing lists, but there might be
some wxPython programmers actually lurking at VTK, and using it
together with wxPython.
I am one of them :smiley:
I have updates the 2 main classes that integrates VTK with wxPython
(wxVTKRenderWindow and wxVTKRenderWindowInteractor) to use the new (!)
wx namespace, namely the import style adopted by wxPython from version
2.5 on.
If someone is interested, I attach the 2 files to this e-mail. There
are a couple of points I would like to expose:

1) I tested the modification only on Windows XP: I have no idea of the
GTK behavior (let alone Mac...). Noting that GTK uses a different
window container (wx.glcanvas.GLCanvas), and some other specific
tricks, it might be useful if some GTK+VTK user could test these 2
files and maybe correct/review them;

2) The wx.EVT_PAINT event machinery in these 2 classes are implemented using:

self.Bind(wx.EVT_PAINT, self.OnPaint)
# turn off background erase to reduce flicker
self.Bind(wx.EVT_ERASE_BACKGROUND, lambda e: None)

and then:

    def OnPaint(self, event):
        """ Handles the wx.EVT_PAINT event for wxVTKRenderWindow. """

        # AG: Is there any possible advantage in using
        # wx.BufferedPaintDC instead of wx.PaintDC?
        dc = wx.PaintDC(self)
        self.Render()

I don't know very well the internal magic of VTK, but would it make
any difference (in terms of speed/refresh) using a wx.BufferedPaintDC
instead of a plain wx.PaintDC? In other words, would a double
buffering inside wxPython made any difference in performace?

Thank you for very hint.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

wxVTKRenderWindow.py (23.3 KB)

wxVTKRenderWindowInteractor.py (20.6 KB)