/pycairo-examples

Pycairo examples - A picture is worth a thousand words

Primary LanguagePython

Pycairo examples - A picture is worth a thousand words

What is this repo for

Beautiful pictures with cool codes will attract more users and make it easier for beginners to learn this library.

While Cairo / Pycairo / cairocffi is a great tool for drawing vector graphics and there are not a few tutorials, it seems that it lacks some amazing examples as matplotlib / gnuplot / TikZ / D3.js / p5.js / ... has.

Thus, I want to show the flexibility and power of Cairo / Pycairo / cairocffi by examples.

I choose Pycairo to create these examples -- it is not hard to reproduce them with Cario or cairocffi.

Installation and configuration

Gallery

Long way to go ...

The structure of this repo

People are used to creating some header files containing commonly used functions, classes and packages, and then import them in the example files.

However, as I am a beginner to a new package, it often makes me puzzled and depressed that the structures of the files are so complicated that I cannot even run a 'hello-world' script successfully.

So on the one hand, I make each example a complete runnable script, which means I will import all the dependencies explicitly and define functions or classes in the same file.

On the other hand, I keep each example as mini as possible, so that readers can focus on only one topic at each time.

Existing resources

Of course, there has been some useful resources. These resources are good, and if you want to implement some more complicated effects which my examples do not cover, those 'tedious' api references may help a lot.

Well, since this repo is not intented to be something like 'awesome-cairo', I just pick several 'official' resources here. You can explore the Internet to find more resources.

Cairo resources

Pycairo resources

cairocffi resources