using Mac OS X CoreGraphics via ctypes

Daniel millerdev at gmail.com
Fri Jun 15 14:06:01 CEST 2007


> > # the next line causes a segfault - what's the right way to do this?
> > #GCS_RGB = cglib.kCGColorSpaceGenericRGB()
>
> Usually, things in the OSX lib that start with k* are a constant - not a
> function. As is this.
>
> Diez

That's what I thought too. But when I try passing it directly as if it
were a constant:

GCS_RGB = cglib.kCGColorSpaceGenericRGB
cs = cglib.CGColorSpaceCreateWithName(GCS_RGB)

I get a segfault too. ctypes said kCGColorSpaceGenericRGB was a
function pointer, so I thought maybe I needed to call it to get the
value (not very good reasoning, I know).

~ Daniel




More information about the Python-list mailing list