using Mac OS X CoreGraphics via ctypes
Diez B. Roggisch
deets at nospam.web.de
Mon Jun 18 06:07:15 EDT 2007
Daniel wrote:
>> > # 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).
I'm not sure what that constant exported is - but how about looking the
constant up in the ref docs and pass it as value? Usually these thingies
are some 4-byte-string, or a normal zero-terminated one.
Diez
More information about the Python-list
mailing list