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. 9 3134
DH wrote:
.... The problem I have though is - can you have an opengl canvas in the same window with other wxpython controls. I've done this in java, basic and C, but the wxpython demo only showed opengl animations running in their own window. This is my problem with vpython and sdl too. I want something that can be embedded in a tk/wx/qt/gtk window with other controls, even other opengl canvases. At the C level, it's just a matter of clipping the drawing and switching the current drawing context.
This works fine. See the browser sub-package of OpenGLContext for a
demo. See also much simpler demo in
OpenGLContext/tests/wx_with_controls.py, which just puts a button and a
wxPython Context (derived from wxGLCanvas) on a window and uses the
button to start/stop the animation. PyOpenGL and wxPython are both just
thin wrappers around their respective C/C++ libraries, so most of the
functionality in the lower levels is available. 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.
Yeah, it doesn't work on Windows for me either with python 2.3. It used to work with python 2.2. Now it complains about not finding glut.
If you encounter a bug like this, please submit a bug-report to the
project so that it can be fixed. As a quick check though, you did
install the GLUT binary package in your system32 directory, right?
PyOpenGL doesn't include the GLUT library itself, only a binding for it.
Have fun,
Mike
_______________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder http://members.rogers.com/mcfletch/ an***@vredegoor.doge.nl (Anton Vredegoor) wrote in message > VPython [1] seems to combine all requirements, OpenGl and NumPy integration, easy to install and use, and at least in my case it makes one very enthusiastic about 3-d programming in Python.
I'm a long-time fan of VPython, but I didn't think it provided
widgets. Can I use some widget set to make buttons to control
applications?
"Mike C. Fletcher" <mc******@rogers.com> wrote in message news:<ma***********************************@python .org>... For balls and sticks this is a pretty trivial task. 4th year comp-sci students are made to do this (well, a lot more) for creating ray-trace renderers in their computer graphics courses. However, being able to load everything into the hardware buffers of a video card is pretty hard to beat as a performance path.
Sorry, I didn't explain my own sarcasm. Writing the code isn't the
problem, it's generating an interface that looks nice and performs
well that is why I think this is only worthy of humorous mention.
Although the JMol project (http://jmol.sf.net) has done a surprisingly
good job with this type of graphics. Thanks in advance for any help or sympathy that people can offer.
Hmm, sympathy? You get to work on graphics and you want sympathy? Some of us would *kill* to have the time to work on graphics ;) .
Thanks for putting this in perspective!
"Mike C. Fletcher" <mc******@rogers.com> wrote in message news:<ma***********************************@python .org>... Rick Muller wrote: ...
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?
Togl is pretty much history. I'll likely fix the installer one last time for the next bug-fix release (2.0.2) and then drop the thing. I've been looking for someone who uses Tkinter+Togl to champion maintenance of the thing for years and never found anyone interested enough to bother. I'm not a huge fan of Tkinter either, for that matter.
Help me out with this: is it that the togl project is history, or that
the Python bindings for Togl are history? I've poked around the Togl
website ( http://togl.sf.net), and I'm not overwhelmed with new
releases. Plus, there don't seem to be many posts to the mailing list
in the last year.
But I'm amazed that more people don't need to put an OpenGL window in
a graphical widget -- seems like a common task. How do people do this?
Thanks for the responses! ri*********@yahoo.com (Rick Muller) wrote: I'm a long-time fan of VPython, but I didn't think it provided widgets. Can I use some widget set to make buttons to control applications?
Look in the demos directory. A two-button mouse would be handy.
Anton
Rick Muller wrote: "Mike C. Fletcher" <mc******@rogers.com> wrote in message news:<ma***********************************@python .org>...
.... Togl is pretty much history. I'll likely fix the installer one last time for the next bug-fix release (2.0.2) and then drop the thing. I've been looking for someone who uses Tkinter+Togl to champion maintenance of the thing for years and never found anyone interested enough to bother. I'm not a huge fan of Tkinter either, for that matter.
Help me out with this: is it that the togl project is history, or that the Python bindings for Togl are history? I've poked around the Togl website (http://togl.sf.net), and I'm not overwhelmed with new releases. Plus, there don't seem to be many posts to the mailing list in the last year.
Togl the Tcl/Tk project is moribund, but then, it's very old technology
that's been stable for years. Togl is just setting up a context for
Tkinter and hooking it up to various event handlers. For the most part
all GUI-library interfaces can be similarly static. The only problems
that come up with it in an average year are configuration and
installation ones. It's the Tkinter binding that's on it's way to the
graveyard, precisely because of those configuration and installation
headaches.
For instance, the upgrade of Tkinter to 8.4 in Python 2.3.x broke the
Togl install for us (it's still broken). It's possible to build and
install the widget manually, but the automated installer fails due to
some deep Tk or Tcl or Togl bug. Working around that is fairly trivial,
but it means going back and reworking the installer's Togl code... not a
big deal... but nowhere near the top of my list of priorities for the
few hours I get now and then to work on the project. So, the 8 or 9
line change doesn't get done, and the Tkinter/Togl binding languishes
(and eventually dies). The problems aren't huge, they just don't have
anyone available who's actually using the library and willing to
find/fix them.
But I'm amazed that more people don't need to put an OpenGL window in a graphical widget -- seems like a common task. How do people do this?
wxPython.
I think there's a few with GTK, Qt and Fox as well, all of which can mix
in widgets fine, but I don't hang out on those user-groups any more to
hear from them and thus be able to say for sure. In all fairness, there
are also lots of people who have, in the past, used Tkinter/Togl, but
since they're not willing to speak up and help with the maintenance I
don't feel the need to plug their platform (in either applicable sense
of the word) ;) .
Have fun,
Mike
_______________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder http://members.rogers.com/mcfletch/ Yeah, it doesn't work on Windows for me either with python 2.3. It used to work with python 2.2. Now it complains about not finding glut.
If you encounter a bug like this, please submit a bug-report to the project so that it can be fixed. As a quick check though, you did install the GLUT binary package in your system32 directory, right? PyOpenGL doesn't include the GLUT library itself, only a binding for it.
I never installed OpenGL or GLUT. OpenGL comes with Windows. In python
2.2 everything worked fine. Does the python 2.3 version not weak link
glut or something?
DH wrote:
.... I never installed OpenGL or GLUT. OpenGL comes with Windows. In python 2.2 everything worked fine. Does the python 2.3 version not weak link glut or something?
No version of PyOpenGL 2.x has, to my knowledge, ever included GLUT.
Could be you installed it without noticing? It's not a complex process
after all, just drag a single DLL to a directory in the system path.
I've been known to forget doing such things in the past. That said,
could be that something is importing OpenGL.GLUT from the Python side
that wasn't importing it before... don't know what that would be, though.
<shrug>Otherwise engaged at the moment, so little time to explore.</shrug>
Have fun,
Mike
_______________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder http://members.rogers.com/mcfletch/
Just wanted to put a plug for our Python-controlled molecular viewer,
see http://www.cgl.ucsf.edu/chimera/. We use Togl and Tkinter and
while I'm annoyed that my patches to Togl were never accepted, I use
them and they're on sourceforge. There are chimera distributions for
x86-Windows, x86-linux/X11, OS X/X11, OS X/Aqua, Irix/X11, and
Tru64/X11. We've gone to bundling everything up into one
self-extracting zip file (a disk image for OS X) to avoid the hassle of
having the user install the 20 different packages that we depend on.
Chimera is only 90% open source at this time but for anybody who will
really do something with the source, we'll open up the rest (except for
the MSMS package from Scripps that we have no control over).
Good luck,
Greg Couch
UCSF Computer Graphics Lab
gregc at cgl dot ucsf dot edu This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Csaba Gabor |
last post by:
Where do I get the appropriate data to draw a good
political map of the world and each continent?
This may seem somewhat off topic (at first), but these two
groups are heavily user presentation...
|
by: Bad_Kid |
last post by:
which is better for what?
|
by: Scott Chang |
last post by:
Hi all,
I tried to use Managed C++ coding of VC++.NET (2002)and
OpenGL version 1.2 to draw a hexagon shape of benzene.
My OpenGLdrawBenzene.cpp is the following:
// This is the main project file...
|
by: David Van D |
last post by:
Hi there,
A few weeks until I begin my journey towards a degree in Computer
Science at Canterbury University in New Zealand,
Anyway the course tutors are going to be teaching us JAVA wth bluej...
|
by: Jessica Weiner |
last post by:
I am writing an application in C# which need to plot graphs and simple
shapes (polygons, circles, squares etc). Which library is better for this
purpose and why? Thanks.
|
by: Achim Domma |
last post by:
Hi,
I'm developing a GUI app in Python/C++ to visualize numerical results.
Currently I'm using Python 2.4 with wx and PyOpenGLContext, but there
are no windows binaries for Python 2.5 for quite...
|
by: math2life |
last post by:
I work with python for two years, are familiar with image processing,
but beginner on PyOpenGL and OpenGL.
Any advice appreciated!
|
by: Andy Cheesman |
last post by:
Dear People,
I was wondering if people could recommend a simple molecular viewing
package written in python. I'm working in Theoretical chemistry and I'm
not after an all-singing dancing...
|
by: goku77 |
last post by:
Hi i want to do a graphics project in Vb.net but have to use OpenGl Libraries . How do i download compatible OpenGl package and how to use them in my .net code.
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: Mushico |
last post by:
How to calculate date of retirement from date of birth
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
| |