(MAC) CoreGraphics module???

Robert Kern robert.kern at gmail.com
Fri Nov 2 01:39:20 CET 2007


David C. Ullrich wrote:
> Running OS X 10.4 "Tiger". Various references
> by Apple and others say that there exists a
> module that gives Quartz bindings, allowing
> all sort of graphics things in Python.
> 
> Sure enough, after installing Xcode I have
> some sample scripts. They all start with
> 
> from CoreGraphics import *
> 
> (as do all the examples in two books, both
> of which say they're talking about Tiger.)
> 
> I get an ImportError trying to import CoreGraphics.
> I found a CoreGraphics.py in a folder named Carbon;
> when I change the script to read
> 
> import Carbon
> from Carbon.CoreGraphics import *
> 
> there's no import error, but all of the Quartz
> things are NameErrors. I look at CoreGraphics.py,
> it's just about twenty lines long, defining a few
> constants with Quartz-sounding names.

That's different than the one that is referenced. The one those articles
reference is only available in the Python that came with the system in
/System/Library/Frameworks/Python.framework, not one that you might have
installed from www.python.org into /Library/Frameworks/Python.framework. The
module was made by Apple, and they have not released the source code, so it
cannot be made to work with the www.python.org distribution.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco




More information about the Python-list mailing list