[Pythonmac-SIG] ctypes and OS X CF types?

Dethe Elza delza at livingcode.org
Mon Oct 22 20:07:12 CEST 2007


On 10/22/07, Bill Janssen <janssen at parc.com> wrote:
> > CoreFoundation is C, not C++.  That said, it'd probably be easier to
> > use PyObjC with NSMetadataQuery instead.
>
> Unfortunately, the Objective-C API is not as functional.

Another option is to write the C wrapper in Objective-C (or find a
third-party framework that already offers the functionality you want),
then write a wrapper to expose it to Python using PyObjC.  I've had
success with this for using Quicktime features not exposed by Cocoa (I
found a third-party library) and the Python wrapper is about three
lines of boilerplate code, if I recall correctly.

For cross-platform stuff, ctypes is probably the way to go.  But if
you're targeting OS X anyway, the PyObjC approach has worked well for
me.

--Dethe


More information about the Pythonmac-SIG mailing list