Yet Another Cairo API Binding

Lawrence D’Oliveiro lawrencedo99 at gmail.com
Wed Jun 1 17:16:12 EDT 2016


Thought I would mention Qahirah <https://github.com/ldo/qahirah>, which is yet another binding for the Cairo <http://cairographics.org/> graphics library. People using Cairo with Python are probably familiar with Pycairo. Qahirah is similar to Pycairo in some ways, but differs importantly in several others:

* It is implemented entirely in Python, using the ctypes module. This offers advantages: automatic support for passing arguments  by keyword, and argument names appearing in help() output. 

* It tries to operate at a higher level than the actual C-centric Cairo API, taking advantage of Python’s powerful data-manipulation facilities. This is explained in the README. 

* Because it is pure Python, the abstractions it implements are “leaky”. As Guido van Rossum has made clear, “We’re all consenting adults here”. If you want to bypass Qahirah’s facilities and make calls directly to the underlying Cairo library, there is nothing to prevent you from doing so. Whether your code will still work with a future version of Qahirah is another matter...

I have also published some examples <https://github.com/ldo/qahirah_examples> of Qahirah in action. And if you know IPython/Jupyter, here <https://github.com/ldo/qahirah_notebooks> are some interactive notebooks illustrating various 2D graphics concepts using Qahirah.



More information about the Python-list mailing list