Advice needed: large OpenGL + Widgets Project for Molecular Graphics

Rick Muller rick_muller at yahoo.com
Mon Mar 15 22:25:50 EST 2004


I have a problem that I would like to get some advice on from other
Pythonistas. I currently manage a (soon to be) open source project for
displaying molecular graphics for a variety of different programs. To
do this I need to draw pictures of the molecules, typically using
OpenGL, and do some basic control, using some widget set.

The code currently uses GTK, and runs on Macintosh OS X under Fink,
and Linux. I would like to support the "normal" (i.e. non-Fink)
distribution on Macintosh, as well as Windows. I'm currently in the
process of doing the Windows port, and it's been harder than I had
hoped, although I haven't given up quite yet. 

But the porting issue is the main problem with the code so far. I'd
like this project to be something that gets other people excited about
Python here, but I'm afraid that the installation issues is going to
make people say things like "see, Java is better after all". So I'm
seriously thinking about switching widget sets sometime down the road,
to try and get a more cross platform application. 

One thing that really puzzles me is how rare putting an OpenGL window
inside of a widget seems to be. Togl is either dead or is
dying. Gtk.GLArea is either dead or dying as well. Gtk.GLExt seems to
be doing well, and wxPython.glcanvas works nicely. In making these
module decisions I normally try to figure out what most people do,
with the reasoning that whatever option that is will be the best
supported choice. However, it seems that *no one* is really interested
in putting an OpenGL panel inside of a widget. Please tell me I'm
wrong!

What follows are the options I'm considering. I would be grateful for
any advice other python programmers can offer.

1. GTK/PyGTK/PyOpenGL/GTK.GLArea
   Advantages: This is the path of least resistance, since this is
   what the program already uses. Currently works well, looks nice,
   and seems stable.

   Disadvantages: GTK isn't really a standard on Windows, and can be
   problematic on other non-Linux platforms (such as Macintosh/Aqua).
   Plus, the number of different packages that need to be installed is
   daunting. Finally, GTK.GLArea is either dead or dying, so I would
   probably have to distribute this module myself.

2. GTK/PyGTK/PyOpenGL/GTK.GLExt
   Advantages: Upgrade to the GTK.GLExt method of putting an OpenGL
   window inside a widget. Looks better and is supported.

   Disadvantages: Need to rewrite some of the uglier code (which
   probably needs to be rewritten anyway) that uses GTK.GLArea. Still
   requires a long list of modules to be installed. And GTK still is
   not a standard library outside of Linux.

3. Tkinter/PyOpenGL/Togl
   Advantages: Least amount of modules to install.

   Disadvantages: Tk is ugly. Tk is old. Tk doesn't look good on
   Macintosh/Aqua. Togl is either dead or dying?

4. wxPython/PyOpenGL
   Advantages: Seems to be a healthy, integrated solution to putting
   an OpenGL window inside of a widget. Pretty widgets, and lots of
   fancy features.

   Disadvantages: The OpenGL install still crashed under Windows. A
   widget set that not many people use? Also requires the most amount
   of code rewrite, although if it's the best option it isn't a
   problem. 

5. Other ideas:
   It is a sign of my own desperation that I'm even considering things
   like writing a canvas widget that can draw balls and sticks, and
   then just doing the matrix algebra in NumPy, rather than using
   OpenGL. 

Thanks in advance for any help or sympathy that people can offer.



More information about the Python-list mailing list