Skip to main content

Python interface for cairo

Project description

https://raw.githubusercontent.com/pygobject/pycairo/main/docs/images/pycairo.svg

Pycairo is a Python module providing bindings for the cairo graphics library. It depends on cairo >= 1.15.10 and works with Python 3.8+ and PyPy3. Pycairo, including this documentation, is licensed under the LGPL-2.1-only OR MPL-1.1.

The Pycairo bindings are designed to match the cairo C API as closely as possible, and to deviate only in cases which are clearly better implemented in a more ‘Pythonic’ way.

pip install pycairo

Installing Pycairo requires cairo including its headers. For more info see “Getting Started”.


import cairo

with cairo.SVGSurface("example.svg", 200, 200) as surface:
    context = cairo.Context(surface)
    x, y, x1, y1 = 0.1, 0.5, 0.4, 0.9
    x2, y2, x3, y3 = 0.6, 0.1, 0.9, 0.5
    context.scale(200, 200)
    context.set_line_width(0.04)
    context.move_to(x, y)
    context.curve_to(x1, y1, x2, y2, x3, y3)
    context.stroke()
    context.set_source_rgba(1, 0.2, 0.2, 0.6)
    context.set_line_width(0.02)
    context.move_to(x, y)
    context.line_to(x1, y1)
    context.move_to(x2, y2)
    context.line_to(x3, y3)
    context.stroke()
https://raw.githubusercontent.com/pygobject/pycairo/main/docs/images/example.svg

Features of the Pycairo bindings:

  • Provides an object oriented interface to cairo.

  • Queries the error status of objects and translates them to exceptions.

  • Provides a C API that can be used by other Python extensions.

  • Fully typed and documented API.

For more information visit https://pycairo.readthedocs.io

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycairo-1.26.0.tar.gz (346.9 kB view details)

Uploaded Source

Built Distributions

pycairo-1.26.0-cp312-cp312-win_arm64.whl (677.9 kB view details)

Uploaded CPython 3.12 Windows ARM64

pycairo-1.26.0-cp312-cp312-win_amd64.whl (859.5 kB view details)

Uploaded CPython 3.12 Windows x86-64

pycairo-1.26.0-cp312-cp312-win32.whl (765.0 kB view details)

Uploaded CPython 3.12 Windows x86

pycairo-1.26.0-cp311-cp311-win_arm64.whl (677.9 kB view details)

Uploaded CPython 3.11 Windows ARM64

pycairo-1.26.0-cp311-cp311-win_amd64.whl (859.1 kB view details)

Uploaded CPython 3.11 Windows x86-64

pycairo-1.26.0-cp311-cp311-win32.whl (764.5 kB view details)

Uploaded CPython 3.11 Windows x86

pycairo-1.26.0-cp310-cp310-win_arm64.whl (677.9 kB view details)

Uploaded CPython 3.10 Windows ARM64

pycairo-1.26.0-cp310-cp310-win_amd64.whl (859.1 kB view details)

Uploaded CPython 3.10 Windows x86-64

pycairo-1.26.0-cp310-cp310-win32.whl (764.5 kB view details)

Uploaded CPython 3.10 Windows x86

pycairo-1.26.0-cp39-cp39-win_arm64.whl (678.0 kB view details)

Uploaded CPython 3.9 Windows ARM64

pycairo-1.26.0-cp39-cp39-win_amd64.whl (859.8 kB view details)

Uploaded CPython 3.9 Windows x86-64

pycairo-1.26.0-cp39-cp39-win32.whl (765.0 kB view details)

Uploaded CPython 3.9 Windows x86

pycairo-1.26.0-cp38-cp38-win_amd64.whl (859.9 kB view details)

Uploaded CPython 3.8 Windows x86-64

pycairo-1.26.0-cp38-cp38-win32.whl (765.0 kB view details)

Uploaded CPython 3.8 Windows x86

File details

Details for the file pycairo-1.26.0.tar.gz.

File metadata

  • Download URL: pycairo-1.26.0.tar.gz
  • Upload date:
  • Size: 346.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pycairo-1.26.0.tar.gz
Algorithm Hash digest
SHA256 2dddd0a874fbddb21e14acd9b955881ee1dc6e63b9c549a192d613a907f9cbeb
MD5 395b9eb21bb2d18801ebe26501ff2b8e
BLAKE2b-256 1c4191955188e97c7b85fbaac6bbf4e33de028899e0aa31bdce99b1afe2eeb17

See more details on using hashes here.

File details

Details for the file pycairo-1.26.0-cp312-cp312-win_arm64.whl.

File metadata

  • Download URL: pycairo-1.26.0-cp312-cp312-win_arm64.whl
  • Upload date:
  • Size: 677.9 kB
  • Tags: CPython 3.12, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pycairo-1.26.0-cp312-cp312-win_arm64.whl
Algorithm Hash digest
SHA256 a611e4d82ad8470138bb46d465d47e8db826d9d80b6a520ccd83ee007f2073e4
MD5 fc12e6a20203dadf92ab15068ada5b6e
BLAKE2b-256 2ac5e4ea63efeca28a3bfafbceccf7101de8b2dd83fc7174490e2d294dbe5860

See more details on using hashes here.

File details

Details for the file pycairo-1.26.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pycairo-1.26.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 859.5 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pycairo-1.26.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8616408ae93de4824a3777ec532ea75643e4bf74e49d601062c0b1788180c962
MD5 b078efd012e4d6d4c76b6c0bed5a76e1
BLAKE2b-256 3f48f6642ee50110498afdf7e52fc0c60d65a7f01574e4dc8830096102bf13f3

See more details on using hashes here.

File details

Details for the file pycairo-1.26.0-cp312-cp312-win32.whl.

File metadata

  • Download URL: pycairo-1.26.0-cp312-cp312-win32.whl
  • Upload date:
  • Size: 765.0 kB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pycairo-1.26.0-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 d63929ab5a2f890a333f2f2f51de9f1c9fe20d1bddc982c2ca577b737448d72f
MD5 ee6aa99c4ccfb4b4b4184eb5a054e61f
BLAKE2b-256 b0884b99e251eff23fcebbc155f076741830b349a2180bb00cd8cc37c91db267

See more details on using hashes here.

File details

Details for the file pycairo-1.26.0-cp311-cp311-win_arm64.whl.

File metadata

  • Download URL: pycairo-1.26.0-cp311-cp311-win_arm64.whl
  • Upload date:
  • Size: 677.9 kB
  • Tags: CPython 3.11, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pycairo-1.26.0-cp311-cp311-win_arm64.whl
Algorithm Hash digest
SHA256 20a31af89d92ffd5fc60c08e65ff649f16e18621a14a40dbdb049fc74942d7a9
MD5 ea10848a97f27435e333c15f95c48e22
BLAKE2b-256 e3e6d9c4e3e1c32883c4f43edfd575d9ecdccac9ba78e23912d74400e14535ed

See more details on using hashes here.

File details

Details for the file pycairo-1.26.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pycairo-1.26.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 859.1 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pycairo-1.26.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d374d9ec6d2f791bf57105d87a9028db1ef2b687848f64a524e447033eae7229
MD5 8aafcc29ac99697cf63cb8e92f9f6255
BLAKE2b-256 5ee2c6a5d093aade4d3c176026cfd4d2ae2c7c071bbbb296fd39458c1853ce92

See more details on using hashes here.

File details

Details for the file pycairo-1.26.0-cp311-cp311-win32.whl.

File metadata

  • Download URL: pycairo-1.26.0-cp311-cp311-win32.whl
  • Upload date:
  • Size: 764.5 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pycairo-1.26.0-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 5986b8da3e7de7ab931d7ad527938df38f75d3a3bdea2b515c786c5ca2c5093c
MD5 5fc9deea922ecc34c906cb48ebf34f2b
BLAKE2b-256 3de5dee0835e467f75dfca888ba372fee8001e77ab3ed13a512c6eeb57c9fe74

See more details on using hashes here.

File details

Details for the file pycairo-1.26.0-cp310-cp310-win_arm64.whl.

File metadata

  • Download URL: pycairo-1.26.0-cp310-cp310-win_arm64.whl
  • Upload date:
  • Size: 677.9 kB
  • Tags: CPython 3.10, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pycairo-1.26.0-cp310-cp310-win_arm64.whl
Algorithm Hash digest
SHA256 1d54e28170a5e790269d9db4c195cca5152ff018ba7e330d0ed05d86ccc2ea7d
MD5 39bb3acb2fa65dbfec81acdad2b925ac
BLAKE2b-256 62543f564d9a87b394318f5d4c50a9c35501ff7b754dcaf173ae923bed433ca9

See more details on using hashes here.

File details

Details for the file pycairo-1.26.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pycairo-1.26.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 859.1 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pycairo-1.26.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b6690a00fb225c19f42d76660e676aba7ae7cb18f3632cb02bce7f0d9b9c3800
MD5 6c45a34e72f2bdff96c095b00c0a24d6
BLAKE2b-256 84a879aab9217cf08817fbc425a5a36f67837cbc877456546b658db7ae7d9dc8

See more details on using hashes here.

File details

Details for the file pycairo-1.26.0-cp310-cp310-win32.whl.

File metadata

  • Download URL: pycairo-1.26.0-cp310-cp310-win32.whl
  • Upload date:
  • Size: 764.5 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pycairo-1.26.0-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 696ba8024d2827e66e088a6e05a3b0aea30d289476bcb2ca47c9670d40900a50
MD5 e7acaefb61a4c85f4142170b76f2f228
BLAKE2b-256 379217fcf820b590af2283a0888f0b493bf00fe8a837d002548a2ed4774076a5

See more details on using hashes here.

File details

Details for the file pycairo-1.26.0-cp39-cp39-win_arm64.whl.

File metadata

  • Download URL: pycairo-1.26.0-cp39-cp39-win_arm64.whl
  • Upload date:
  • Size: 678.0 kB
  • Tags: CPython 3.9, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pycairo-1.26.0-cp39-cp39-win_arm64.whl
Algorithm Hash digest
SHA256 a8f3b567ba2ad55624a809823ccf75aff8d768c20216cb5888365f6fc695c1d2
MD5 525c157775dda796b2f0ca052edcf8db
BLAKE2b-256 cfa56799d7456bb455eab71b0e0624cd7f3eebd382945da147f00055c7f2d295

See more details on using hashes here.

File details

Details for the file pycairo-1.26.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pycairo-1.26.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 859.8 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pycairo-1.26.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 3e4e18ea03122e60abe3eb611e2849859cc950083ff85d8369328eadf3df63f5
MD5 435869de15670dde1e8de60319776a94
BLAKE2b-256 bd18e5b103fb0c64bc0009a8261892755699eb2be54538a8bbf41e1bf7e26a61

See more details on using hashes here.

File details

Details for the file pycairo-1.26.0-cp39-cp39-win32.whl.

File metadata

  • Download URL: pycairo-1.26.0-cp39-cp39-win32.whl
  • Upload date:
  • Size: 765.0 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pycairo-1.26.0-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 9fa51168010e2dfb45499df071fca2d921893f724646f3454951000a7ad0cabb
MD5 7dda5df7b637ceba4f6625333d9ab635
BLAKE2b-256 3d114df901467eec63a8955858538729780ba1068731c502c9475ef0aeed61a6

See more details on using hashes here.

File details

Details for the file pycairo-1.26.0-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: pycairo-1.26.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 859.9 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pycairo-1.26.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 aac447b423b33b64119ecdd1ffebf9163b07f5401c5da50c707197efdd1c918a
MD5 a6d6e8a327517f6eafe0f836b149faae
BLAKE2b-256 d64801dc41664c9dd6b4710027cfd5e0afabdceb243f9871d050c47a1c34c2d2

See more details on using hashes here.

File details

Details for the file pycairo-1.26.0-cp38-cp38-win32.whl.

File metadata

  • Download URL: pycairo-1.26.0-cp38-cp38-win32.whl
  • Upload date:
  • Size: 765.0 kB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pycairo-1.26.0-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 675578bc6d62d15ff8669f264783efc9c8c73e3a6f564b294a70fb45a2f78667
MD5 b1e94bf3c29c73f75808f6e906305ef4
BLAKE2b-256 ee234a316b5f5119f9858e54200253b016c3777a589c440795c84972645e5b8b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page