[Pythonmac-SIG] problem importing OpenGL.Tk

Bob Ippolito bob at redivi.com
Mon Oct 13 19:44:47 EDT 2003


On Monday, Oct 13, 2003, at 19:24 America/New_York, Andrew Straw wrote:

> Bob Ippolito wrote:
>
>>
>> On Monday, Oct 13, 2003, at 11:22 America/New_York, 
>> bweiland at chisystems.com wrote:
>>
>>>     According to Bob Ippolito:
>>>
>>>> Unfortunately, you're out of luck.  Togl has not been ported to OS X
>>>> yet, at least not for AquaTk.  I just took a look at Togl and it 
>>>> seems
>>>> nontrivial to compile for OS X (at least a few hours).  Your best 
>>>> bet
>>>> is to get rid of your dependency on Tk altogether and switch to
>>>> something like wxPython, pygame, GLUT, PyObjC + Cocoa, etc. for your
>>>> GUI.
>>>
>>>     Oddly enough, I was just going thru this same ordeal myself.  
>>> Tk, if
>>> Togl worked, would probably still be the best option for portable 
>>> python
>>> GUI's that need OpenGL stuff, IMHO.  Here's why I think so (and not 
>>> trying
>>> to start a flame war):
>>>     - tried wxPython - had weird problems with low framerate and 
>>> flicker
>>> compared to just drawing in a GLUT window (maybe this was just me?);
>>> besides, I like Tk better for a quick hacked-together interface;
>>>     - pygame - would be good, but pyui doesn't seem to be working yet
>>> for GUI elements on OS X;
>>>     - GLUT - not really enough GUI;
>>>     - PyObjC - not portable, but otherwise nice;
>>>     - also, PyQt would be great, but the license is restrictive (it
>>> precludes portability to Windows if you're using the GPL'ed version; 
>>> it's
>>> expensive otherwise).
>>>
>>>     Enough complaining --  I looked at trying to port it, but it 
>>> seemed
>>> like a lot of time I can't spend right now (since I really don't 
>>> understand
>>> how the whole Tk side of things is put together).  If anyone can 
>>> provide
>>> some pointers  that could shorten the time, I might try.  If anyone 
>>> is
>>> inclined to do the port, there are at least two users who would want 
>>> it ;)
>>
>> I'll take a closer look at it later this week if I find the time.
>
> Recently, the maintainer of PyOpenGL has indicated that he's dropping 
> Togl support (for Windows?) in the next release due to high 
> maintenance requirements and limited usage.  Not to discourage you 
> from working on Togl, but I therefore think Tk may not be your best 
> long-term cross-platform solution for OpenGL + GUI unless someone is 
> willing to take over python/togl maintenance in general (and on the 
> Mac in specific).

Well forget that then :)  I'm not a big fan of Tk anyways.

Here's what I recall seeing from when I looked at it last night, if it 
helps:
	* It doesn't use distutils (ugh)
	* There are a whole bunch of paths that need to be changed to get it 
to work
	* You probably don't want to use the -DLOCAL_TK_HEADERS (from memory.. 
probably wrong, but the name is similar) cflag, since the version they 
have locally isn't the patched AquaTk version
	* Tcl/Tk plugins end up living in /Library/Tcl
	* Tcl/Tk plugins are dylibs, not bundles
	* There's X11 support, and AGL (OS9) support (enabled with 
-Dmacintosh).  The AGL stuff should work on OS X, but you'd probably 
have to rewrite a bunch of the code that shoves the context into a 
window.  The X11 stuff is a lost cause, cause _tkinter with MacPython 
is compiled to link against AquaTk, not an X11 Tk.  Though the AquaTk 
does have a subset of X11 headers inside it, so you may need to -I 
those when compiling.  Not sure whether they're standard or not.

I've attached the Makefile that I have so far (from Togl-1.6, looks 
like I checked it out from CVS at some point)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile
Type: application/octet-stream
Size: 6467 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20031013/864dff3c/Makefile.obj
-------------- next part --------------


Here's the changes I had made to togl.c, just headers at this point:
[crack:PyOpenGL2/src/Togl-1.6] bob% cvs diff -u togl.c
Index: togl.c
===================================================================
RCS file: /cvsroot/pyopengl/PyOpenGL2/src/Togl-1.6/togl.c,v
retrieving revision 1.2
diff -u -r1.2 togl.c
--- togl.c      4 Aug 2003 13:55:01 -0000       1.2
+++ togl.c      13 Oct 2003 23:43:42 -0000
@@ -37,11 +37,8 @@

  /*** Mac headers ***/
  #elif defined(macintosh) && !defined(WIN32) && !defined(X11)
-#include <Gestalt.h>
-#include <Traps.h>
-#include <agl.h>
-#include <tclMacCommonPch.h>
-
+#include <Carbon/Carbon.h>
+#include <AGL/AGL.h>
  #else                           /* make sure only one platform defined 
*/
  #error Unsupported platform, or confused platform defines...
  #endif
@@ -60,6 +57,9 @@
  #endif

  #ifdef WIN32
+#  include <tkPlatDecls.h>
+#endif
+#ifdef macintosh
  #  include <tkPlatDecls.h>
  #endif

Have fun! :)

-bob


More information about the Pythonmac-SIG mailing list