• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

cairo/H07-May-2022-12,2949,785

docs/H19-Apr-2019-7,3504,912

examples/H19-Apr-2019-1,4471,010

pycairo.egg-info/H03-May-2022-9877

tests/H19-Apr-2019-3,6512,665

COPYINGH A D06-Apr-2017621 1813

COPYING-LGPL-2.1H A D06-Apr-201725.9 KiB511422

COPYING-MPL-1.1H A D06-Apr-201725.2 KiB471396

MANIFEST.inH A D24-Jun-2018339 1413

NEWSH A D19-Apr-201926.8 KiB985705

PKG-INFOH A D19-Apr-20194.1 KiB9877

PKG-INFO.inH A D04-Nov-20181 KiB2322

README.rstH A D24-Feb-20192.6 KiB7656

meson.buildH A D27-Jan-20193.5 KiB129113

setup.cfgH A D19-Apr-2019577 3528

setup.pyH A D15-Feb-201917.5 KiB602463

README.rst

1.. image:: https://cdn.rawgit.com/pygobject/pycairo/master/docs/images/pycairo.svg
2   :align: center
3   :width: 370px
4
5|
6
7Pycairo is a Python module providing bindings for the `cairo graphics library
8<https://cairographics.org/>`__. It depends on **cairo >= 1.13.1** and
9works with **Python 2.7+** as well as **Python 3.4+**. Pycairo, including this
10documentation, is licensed under the **LGPLv2.1** as well as the **MPLv1.1**.
11
12The Pycairo bindings are designed to match the cairo C API as closely as
13possible, and to deviate only in cases which are clearly better implemented in
14a more ‘Pythonic’ way.
15
16.. code:: shell
17
18    pip install pycairo
19
20Installing Pycairo requires cairo including its headers. For more info see
21"`Getting Started
22<https://pycairo.readthedocs.io/en/latest/getting_started.html>`__".
23
24----
25
26.. image:: https://cdn.rawgit.com/pygobject/pycairo/master/docs/images/example.svg
27   :align: right
28   :width: 200px
29
30.. code:: python
31
32    import cairo
33
34    with cairo.SVGSurface("example.svg", 200, 200) as surface:
35        context = cairo.Context(surface)
36        x, y, x1, y1 = 0.1, 0.5, 0.4, 0.9
37        x2, y2, x3, y3 = 0.6, 0.1, 0.9, 0.5
38        context.scale(200, 200)
39        context.set_line_width(0.04)
40        context.move_to(x, y)
41        context.curve_to(x1, y1, x2, y2, x3, y3)
42        context.stroke()
43        context.set_source_rgba(1, 0.2, 0.2, 0.6)
44        context.set_line_width(0.02)
45        context.move_to(x, y)
46        context.line_to(x1, y1)
47        context.move_to(x2, y2)
48        context.line_to(x3, y3)
49        context.stroke()
50
51----
52
53Features of the Pycairo bindings:
54
55* Provides an object oriented interface to cairo.
56* Queries the error status of objects and translates them to exceptions.
57* Provides a C API that can be used by other Python extensions.
58
59If Pycairo is not what you need, have a look at `cairocffi
60<https://cairocffi.readthedocs.io>`__, which is an API compatible package
61using `cffi <https://cffi.readthedocs.io/>`__ or `Qahirah
62<https://github.com/ldo/qahirah>`__, which is using `ctypes
63<https://docs.python.org/3/library/ctypes.html>`__ and provides a more
64"pythonic" API with less focus on matching the cairo C API.
65
66For more information visit https://pycairo.readthedocs.io
67
68.. image:: https://travis-ci.org/pygobject/pycairo.svg?branch=master
69    :target: https://travis-ci.org/pygobject/pycairo
70
71.. image:: https://dev.azure.com/pygobject/pycairo/_apis/build/status/pygobject.pycairo
72  :target: https://dev.azure.com/pygobject/pycairo/_build/latest?definitionId=1
73
74.. image:: https://codecov.io/gh/pygobject/pycairo/branch/master/graph/badge.svg
75  :target: https://codecov.io/gh/pygobject/pycairo
76