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

Prabhu Ramachandran prabhu at aero.iitm.ernet.in
Sat May 24 02:28:08 EDT 2003


Hi John,

Sorry for such a delayed response but I'm slowly getting over backlog.

>>>>> "JH" == John Hunter <jdhunter at ace.bsd.uchicago.edu> writes:

>>>>> "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

[ Quoting entire most of message since its been a long while ]

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

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

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

BTW, I'm sure you know but the current GTK widget in VTK CVS also uses
gtkgl.

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

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

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

I took a brief look at your code.  It looks quite similar to the
existing code.  There do seem to be a few API changes though.  I don't
use pygtk or pygtk2.  While I have pygtk1 installed I dont have pygtk2
installed, consequently I cant really experiment with code.  I have a
few issues/questions for you:

 1. I'd like there to be one widget in VTK CVS that handles both pygtk
 and pygtk2 gracefully.

 2. The changes should also be ported to the Interactor widget.

 3. Looking at your code there seem to be API changes from pygtk to
 pygtk2 most crucually with the way gdk/GDK behaves.

   a. Is there a good way way to detect which version of pygtk is
   installed?  One obvious way would be to try importing 'gdk' but I
   don't know if that is the right way.

   b. When initializing the parent DrawingArea are the extra arguments
   (gtkgl.RGBA, gtkgl.DOUBLEBUFFER) unnecessary?

   c. Is set_size_request better than set_usize?

   d. There is no module called GDK anymore?  If so is gdk identical
   or is there a backwards compatible interface?

   e. You are not using self.get_window() to get the window and
   instead use self.widget.window.  Is this recommended?

   f. In OnConfigure you set self.widget = wid?  That looks fishy.

   g. Is gdk.keyval_from_name("q") the correct way to look for key
   values.  Are gdk.q/gdk.Q deprecated?


So, if you can clarify on these or better still come up with a way to
integrate your code with the existing code in VTK CVS, it would be
great.  Then these changes can also be made to the Interactor widget.
This way the Gtk widgets will work with the old and new versions of
pygtk.

Thanks.

cheers,
prabhu



More information about the vtkusers mailing list