[vtkusers] Can I use GTK to develop the VTK program?

John Hunter jdhunter at ace.bsd.uchicago.edu
Sat Mar 22 11:01:40 EST 2003


>>>>> "Prabhu" == Prabhu Ramachandran <prabhu at aero.iitm.ernet.in> writes:

    Prabhu> If you want to use PyGTK, the Wrapping/Python/vtk/gtk
    Prabhu> directory contains a couple of useful widgets that let you
    Prabhu> build a GTK + VTK application.  If you want to do this via
    Prabhu> C++ then look at this:

If you are using pygtk2, the class
Wrapping/Python/vtk/gtk/GtkVTKRenderWindow.py will probably not work
for you, because the xid attribute required by this class is not
exposed in pygtk2.  John Luebs has a patch you can apply to the CVS
version of pygtk.  See this thread on the pygtk mailing list

http://www.daa.com.au/pipermail/pygtk/2003-March/004641.html

A number of people are starting to use gtkglext for opengl rendering,
which enables you to render on any gtk widget.  I have modified
GtkGLExtVTKRenderWindow to work with this extension, but you'll still
need the patch.  See 

http://www.daa.com.au/pipermail/pygtk/2003-March/004749.html

If you are interested in the GtkGLExtRenderWindow code, you can get it
from that link.

BTW Prabu, the Lueb patch also exposes the hwnd attribute for win32
systems, which I think is the analog of the xid attribute.  Hence it
should be possible to port the GtkVTKRenderWindow code to win32 with
the patched pygtk2.  

Something like

    def OnRealize(self, *args):
        if self.__Created == 0:
            # you can't get the xid without the window being realized.
            self.realize()
            if sys.platform=='win32':
              win_id = str(self.get_window().hwnd)
            else:
              win_id = str(self.get_window().xid)
            self._RenderWindow.SetWindowInfo(win_id)
            self.__Created = 1
        return gtk.TRUE

I haven't been able to test this yet.

John Hunter



More information about the vtkusers mailing list