[cairo] Qahirah: A High-Level Cairo API Binding For Python 3

Lawrence D'Oliveiro ldo at geek-central.gen.nz
Fri Mar 6 16:04:31 PST 2015

On Fri, 06 Mar 2015 15:49:36 -0800, Bill Spitzak wrote:

> This looks really nice.

Please give it a try, check out the examples etc. There is no separate
documentation as yet, but the Python “help()” command will work. :)

> Is it generated automatically or did you write all this by hand?

All done by hand (with help from a few Emacs macros).

> Is there a reason you always have create() methods rather than making 
> the object constructor take the arguments?

Because there can be only one constructor, whereas Cairo typically
offers many different create() methods. I know that Pycairo breaks out
its Pattern class into a whole lot of subclasses (SolidPattern,
LinearGradient etc) so that it can use constructors to create them, but
this seemed unnecessarily fragmented to me. The only separate subclass
of Pattern I have is MeshPattern.

OK, there is another reason: the constructor is usually reserved for
internal use. That is where I pass the _cairobj value which is the
pointer to the underlying Cairo object.

> Do you know if it will work with Python < 3?

Probably not.

More information about the cairo mailing list