[Pythonmac-SIG] Apple's python extensions into Quartz2D

Bob Ippolito bob at redivi.com
Sat May 28 04:17:40 CEST 2005


On May 27, 2005, at 7:00 PM, nickg wrote:



> On May 27, 2005, at 9:39 PM, Bob Ippolito wrote:
>
>
>>
>> On May 27, 2005, at 6:32 PM, nickg wrote:
>>
>>
>>
>>> What's the latest with Apple's python extensions to use Quartz2D?
>>> I'd like to use them with the latest python release but I can't
>>> figure out where the original source code for the extensions are  
>>> so I
>>> can't do a build.  It looks like they used SWIG, but that's about as
>>> much as I figured out.
>>
>> They're not open source.  You can't use them with anything but the
>> release of Python that ships with Mac OS X.  File a bug.  I filed
>> mine over a year ago:
>>
>> rdar://3540071
>> Python CoreGraphics extension can't readily be used by other Python
>> versions
>> 26-Jan-2004 02:10 PM
>>
>> I updated it this april to say "hey, this actually matters now that
>> 2.4.1 is out there", but I still have not received a response.
>>
>> I believe the reason is that the extension does some really
>> horrible nasty SPI hacks in order to lift some of the restrictions
>> that are normally imposed by these APIs (WindowServer connections,
>> etc.)  At least, that's what I gathered from reverse engineering it
>> a bit.
>>
>>
>>
>>> Or this is something I might be able to do with PyObjC (which I  
>>> never
>>> have used)?  Or is there another alternative?
>>
>> It depends on what you're trying to do.  The Cocoa APIs are higher
>> level than Quartz2D and imposes a few restrictions along the way.
>
> Odd, the Python API is nearly 1-1 with the CoreGraphics C API so I
> wouldn't expect any hacks.  Oh well.

Image loading and initialization are whack.  It also installs several  
categories on AppKit classes that probably break stuff if you happen  
to import CoreGraphics from a GUI app.

File a bug.

>> I'm just using it to "draw" into a PDF or buffer to save a file.  No
>> UI or Windows needed.  Can PyObjC make these calls?  I'm new to the
>> all the mac-python trickery.

Again, it depends.  The API is different, so for some definitions of  
"draw" it will work just fine, but not all of them.  You can probably  
do something equivalent, but it's going to require a WindowServer  
connection (i.e. invoked by pythonw as root or by the logged-in user).

File a bug.

-bob



More information about the Pythonmac-SIG mailing list