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.9+ 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.28.0.tar.gz (662.5 kB view details)

Uploaded Source

Built Distributions

pycairo-1.28.0-cp313-cp313-win_arm64.whl (691.7 kB view details)

Uploaded CPython 3.13 Windows ARM64

pycairo-1.28.0-cp313-cp313-win_amd64.whl (841.8 kB view details)

Uploaded CPython 3.13 Windows x86-64

pycairo-1.28.0-cp313-cp313-win32.whl (750.6 kB view details)

Uploaded CPython 3.13 Windows x86

pycairo-1.28.0-cp312-cp312-win_arm64.whl (691.7 kB view details)

Uploaded CPython 3.12 Windows ARM64

pycairo-1.28.0-cp312-cp312-win_amd64.whl (841.8 kB view details)

Uploaded CPython 3.12 Windows x86-64

pycairo-1.28.0-cp312-cp312-win32.whl (750.6 kB view details)

Uploaded CPython 3.12 Windows x86

pycairo-1.28.0-cp311-cp311-win_arm64.whl (691.9 kB view details)

Uploaded CPython 3.11 Windows ARM64

pycairo-1.28.0-cp311-cp311-win_amd64.whl (841.5 kB view details)

Uploaded CPython 3.11 Windows x86-64

pycairo-1.28.0-cp311-cp311-win32.whl (750.4 kB view details)

Uploaded CPython 3.11 Windows x86

pycairo-1.28.0-cp310-cp310-win_arm64.whl (691.9 kB view details)

Uploaded CPython 3.10 Windows ARM64

pycairo-1.28.0-cp310-cp310-win_amd64.whl (841.5 kB view details)

Uploaded CPython 3.10 Windows x86-64

pycairo-1.28.0-cp310-cp310-win32.whl (750.4 kB view details)

Uploaded CPython 3.10 Windows x86

pycairo-1.28.0-cp39-cp39-win_arm64.whl (691.9 kB view details)

Uploaded CPython 3.9 Windows ARM64

pycairo-1.28.0-cp39-cp39-win_amd64.whl (842.2 kB view details)

Uploaded CPython 3.9 Windows x86-64

pycairo-1.28.0-cp39-cp39-win32.whl (750.7 kB view details)

Uploaded CPython 3.9 Windows x86

File details

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

File metadata

  • Download URL: pycairo-1.28.0.tar.gz
  • Upload date:
  • Size: 662.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pycairo-1.28.0.tar.gz
Algorithm Hash digest
SHA256 26ec5c6126781eb167089a123919f87baa2740da2cca9098be8b3a6b91cc5fbc
MD5 f1bb0ee59ddd78a452f27ffda3ed68ae
BLAKE2b-256 40d9412da520de9052b7e80bfc810ec10f5cb3dbfa4aa3e23c2820dc61cdb3d0

See more details on using hashes here.

File details

Details for the file pycairo-1.28.0-cp313-cp313-win_arm64.whl.

File metadata

  • Download URL: pycairo-1.28.0-cp313-cp313-win_arm64.whl
  • Upload date:
  • Size: 691.7 kB
  • Tags: CPython 3.13, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pycairo-1.28.0-cp313-cp313-win_arm64.whl
Algorithm Hash digest
SHA256 026afd53b75291917a7412d9fe46dcfbaa0c028febd46ff1132d44a53ac2c8b6
MD5 a1dab3ee76da8f11cb1363ed31aa6f8c
BLAKE2b-256 3ecea3f5f1946613cd8a4654322b878c59f273c6e9b01dfadadd3f609070e0b9

See more details on using hashes here.

File details

Details for the file pycairo-1.28.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pycairo-1.28.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 841.8 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pycairo-1.28.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 082aef6b3a9dcc328fa648d38ed6b0a31c863e903ead57dd184b2e5f86790140
MD5 783b6b6f6e294b13434ff11ab9d83c64
BLAKE2b-256 8b1cebadd290748aff3b6bc35431114d41e7a42f40a4b988c2aaf2dfed5d8156

See more details on using hashes here.

File details

Details for the file pycairo-1.28.0-cp313-cp313-win32.whl.

File metadata

  • Download URL: pycairo-1.28.0-cp313-cp313-win32.whl
  • Upload date:
  • Size: 750.6 kB
  • Tags: CPython 3.13, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pycairo-1.28.0-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 d13352429d8a08a1cb3607767d23d2fb32e4c4f9faa642155383980ec1478c24
MD5 05130773a8cf35709a58907cda8c95c2
BLAKE2b-256 59a7c3e5ed55781dfe1b31eb4a2482aeae707671f3d36b0ea53a1722f4a3dfe9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.28.0-cp312-cp312-win_arm64.whl
  • Upload date:
  • Size: 691.7 kB
  • Tags: CPython 3.12, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pycairo-1.28.0-cp312-cp312-win_arm64.whl
Algorithm Hash digest
SHA256 957e0340ee1c279d197d4f7cfa96f6d8b48e453eec711fca999748d752468ff4
MD5 bf58ad129647221dcb96beb00a7bd7b3
BLAKE2b-256 c008aa0903612ea0e8686ad6af58d4fb9cbab8ee0b0831201cddf7abd578d045

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.28.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 841.8 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pycairo-1.28.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d50d190f5033992b55050b9f337ee42a45c3568445d5e5d7987bab96c278d8a6
MD5 a215dba0baaa543a4b78ccc302fc1fc5
BLAKE2b-256 2eba259fc9a4d3afdad1e5b9db52b9d8a5df67f70dd787167185e8ec8a1af007

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.28.0-cp312-cp312-win32.whl
  • Upload date:
  • Size: 750.6 kB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pycairo-1.28.0-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 c00cfbb7f30eb7ca1d48886712932e2d91e8835a8496f4e423878296ceba573e
MD5 7148cb4d1d62199d6d0966c34bdcd683
BLAKE2b-256 a9d7206d7945aac5c6c889e7fea4011410d1311455a1d8dfce66106d8d700b7f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.28.0-cp311-cp311-win_arm64.whl
  • Upload date:
  • Size: 691.9 kB
  • Tags: CPython 3.11, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pycairo-1.28.0-cp311-cp311-win_arm64.whl
Algorithm Hash digest
SHA256 c6ae15392e28ebfc0b35d8dc05d395d3b6be4bad9ad4caecf0fa12c8e7150225
MD5 4fd552be299539cb52c25919341f3c57
BLAKE2b-256 eb9913031086fb4d4ea71568d9ce74e03afbb2e18047f1e6b4e8674851f0414f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.28.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 841.5 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pycairo-1.28.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6339979bfec8b58a06476094a9a5c104bd5a99932ddaff16ca0d9203d2f4482c
MD5 3dce92a2a4d7fa387ba9cc172d098825
BLAKE2b-256 aa021169a2917b043998585f9dd0f36da618947fdf9b6cc0e9ff9852aa4d548b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.28.0-cp311-cp311-win32.whl
  • Upload date:
  • Size: 750.4 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pycairo-1.28.0-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 0fee15f5d72b13ba5fd065860312493dc1bca6ff2dce200ee9d704e11c94e60a
MD5 c0deaf78b300fa8732e7401f48791e33
BLAKE2b-256 c99447d75f4eaac865f32e0550ed42869f8b3c4036f8e2b1e6163e9548f4d44f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.28.0-cp310-cp310-win_arm64.whl
  • Upload date:
  • Size: 691.9 kB
  • Tags: CPython 3.10, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pycairo-1.28.0-cp310-cp310-win_arm64.whl
Algorithm Hash digest
SHA256 e955328c1a5147bf71ee94e206413ce15e12630296a79788fcd246c80e5337b8
MD5 fc76f7c499988b8780370e07a1da6213
BLAKE2b-256 844b3495baabd3c830bf80bf112a0e645342bfe8f3fc05ed6423444adf62d496

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.28.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 841.5 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pycairo-1.28.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c8ab91a75025f984bc327ada335c787efb61c929ea0512063793cb36cee503d4
MD5 792275cbb7799cdec65e9affd7909fa7
BLAKE2b-256 0079e941186c2275333643504f57711b157ba17e81a2be805346585ad7fd382e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.28.0-cp310-cp310-win32.whl
  • Upload date:
  • Size: 750.4 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pycairo-1.28.0-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 53e6dbc98456f789965dad49ef89ce2c62f9a10fc96c8d084e14da0ffb73d8a6
MD5 5e73a13465c1b1bae337bd59c4cee917
BLAKE2b-256 3e676e5d6328c6037f0479017f51e97f5cbb79a68ed6e93f671dac17cb47bf2e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.28.0-cp39-cp39-win_arm64.whl
  • Upload date:
  • Size: 691.9 kB
  • Tags: CPython 3.9, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pycairo-1.28.0-cp39-cp39-win_arm64.whl
Algorithm Hash digest
SHA256 458877513eb2125513122e8aa9c938630e94bb0574f94f4fb5ab55eb23d6e9ac
MD5 b5de8e68333ba12e890d264833f15b8d
BLAKE2b-256 a8c5fce33dbb973c5ee7606167056502a70eb316350c41c7656e5739a5f9e490

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.28.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 842.2 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pycairo-1.28.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 da0d1e6d4842eed4d52779222c6e43d254244a486ca9fdab14e30042fd5bdf28
MD5 59ceebd67088d141270c7b83000bf211
BLAKE2b-256 f477872e843993bb152f93e970f0807ee08b5a496116ad8eadfa0a1590452111

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.28.0-cp39-cp39-win32.whl
  • Upload date:
  • Size: 750.7 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for pycairo-1.28.0-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 3ed16d48b8a79cc584cb1cb0ad62dfb265f2dda6d6a19ef5aab181693e19c83c
MD5 4884303d98c8845883e9a9f842645df3
BLAKE2b-256 790e476ffe64b309672aa4012897d91a2bda7e5b2eb43504bbff48be03e5055c

See more details on using hashes here.

Supported by

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