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.1.tar.gz (346.9 kB view details)

Uploaded Source

Built Distributions

pycairo-1.26.1-cp312-cp312-win_arm64.whl (675.5 kB view details)

Uploaded CPython 3.12 Windows ARM64

pycairo-1.26.1-cp312-cp312-win_amd64.whl (862.1 kB view details)

Uploaded CPython 3.12 Windows x86-64

pycairo-1.26.1-cp312-cp312-win32.whl (766.9 kB view details)

Uploaded CPython 3.12 Windows x86

pycairo-1.26.1-cp311-cp311-win_arm64.whl (675.6 kB view details)

Uploaded CPython 3.11 Windows ARM64

pycairo-1.26.1-cp311-cp311-win_amd64.whl (861.9 kB view details)

Uploaded CPython 3.11 Windows x86-64

pycairo-1.26.1-cp311-cp311-win32.whl (766.5 kB view details)

Uploaded CPython 3.11 Windows x86

pycairo-1.26.1-cp310-cp310-win_arm64.whl (675.6 kB view details)

Uploaded CPython 3.10 Windows ARM64

pycairo-1.26.1-cp310-cp310-win_amd64.whl (861.9 kB view details)

Uploaded CPython 3.10 Windows x86-64

pycairo-1.26.1-cp310-cp310-win32.whl (766.5 kB view details)

Uploaded CPython 3.10 Windows x86

pycairo-1.26.1-cp39-cp39-win_arm64.whl (675.9 kB view details)

Uploaded CPython 3.9 Windows ARM64

pycairo-1.26.1-cp39-cp39-win_amd64.whl (862.5 kB view details)

Uploaded CPython 3.9 Windows x86-64

pycairo-1.26.1-cp39-cp39-win32.whl (766.8 kB view details)

Uploaded CPython 3.9 Windows x86

pycairo-1.26.1-cp38-cp38-win_amd64.whl (862.5 kB view details)

Uploaded CPython 3.8 Windows x86-64

pycairo-1.26.1-cp38-cp38-win32.whl (766.8 kB view details)

Uploaded CPython 3.8 Windows x86

File details

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

File metadata

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

File hashes

Hashes for pycairo-1.26.1.tar.gz
Algorithm Hash digest
SHA256 a11b999ce55b798dbf13516ab038e0ce8b6ec299b208d7c4e767a6f7e68e8430
MD5 36504ac01533ae14f0d2337516bbae2e
BLAKE2b-256 194f0d48a017090d4527e921d6892bc550ae869902e67859fc960f8fe63a9094

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.26.1-cp312-cp312-win_arm64.whl
  • Upload date:
  • Size: 675.5 kB
  • Tags: CPython 3.12, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pycairo-1.26.1-cp312-cp312-win_arm64.whl
Algorithm Hash digest
SHA256 5577b51543ea4c283c15f436d891e9eaf6fd43fe74882adb032fba2c271f3fe9
MD5 20c6203d3f2adfd37ca0b5b09865ec98
BLAKE2b-256 f671f21682a17ed0e23d2545a2de39a6f30255868cd81c5f78505640af75f8d3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.26.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 862.1 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pycairo-1.26.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 36131a726f568b2dbc5e78ff50fbaa379e69db00614d46d66b1e4289caf9b1ce
MD5 77571e525e687fdc7dfb9593f11580bd
BLAKE2b-256 60189d1bfe0c0ff23c65f04001d62d358e56fba11bbc1a86587aabc93f1809ba

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.26.1-cp312-cp312-win32.whl
  • Upload date:
  • Size: 766.9 kB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pycairo-1.26.1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 5cc1808e9e30ccd0f4d84ba7700db5aab5673f8b6b901760369ebb88a0823436
MD5 97c1b8a9815a9c511d19631ff5e835c0
BLAKE2b-256 e0b86b92544a90444fc97ea903798bc533e043b2d4653cb2a679d220978741c6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.26.1-cp311-cp311-win_arm64.whl
  • Upload date:
  • Size: 675.6 kB
  • Tags: CPython 3.11, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pycairo-1.26.1-cp311-cp311-win_arm64.whl
Algorithm Hash digest
SHA256 7a307111de345304ed8eadd7f81ebd7fb1fc711224aa314a4e8e33af7dfa3d27
MD5 59a7ee8d3e051bd6413bf227eef83dd1
BLAKE2b-256 6de5e33bdb7a6cf7a86f994fc5950793b79dfd090b4302301daa62e5e7285bd6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.26.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 861.9 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pycairo-1.26.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8d2889e03a095de5da9e68a589b691a3ada09d60ef18b5fc1b1b99f2a7794297
MD5 634b3cfe63efe93cac9bf8bb0762398e
BLAKE2b-256 2d54fa4f1749b572853f537214bb01b6601b0eba7a9857b3a660e939b1959f4b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.26.1-cp311-cp311-win32.whl
  • Upload date:
  • Size: 766.5 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pycairo-1.26.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 56a29623aa7b4adbde5024c61ff001455b5a3def79e512742ea45ab36c3fe24b
MD5 2aaf5624df24dcac63cb10f9bf7b3d9f
BLAKE2b-256 b7257ef228b6436423a606c03044e65f9d7066179e0d3d7e3648979c7899ce9e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.26.1-cp310-cp310-win_arm64.whl
  • Upload date:
  • Size: 675.6 kB
  • Tags: CPython 3.10, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pycairo-1.26.1-cp310-cp310-win_arm64.whl
Algorithm Hash digest
SHA256 067191315c3b4d09cad1ec57cdb8fc1d72e2574e89389c268a94f22d4fa98b5f
MD5 64f2117355b58a8dc8dacf9977962bcb
BLAKE2b-256 8c3ba0d007048dd550afc3394bc7d80f6ddd1fa9c8d2d12b75aab651f604dba1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.26.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 861.9 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pycairo-1.26.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 acfc76924ed668d8fea50f6cc6097b9a57ef6cd3dc3f2fa20814380d639a6dd2
MD5 8d2952927efd46f50489f4c6985a3a29
BLAKE2b-256 32eccf8510f556ce950546216738cdbee631e917ad6734b5cd84f9204756f708

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.26.1-cp310-cp310-win32.whl
  • Upload date:
  • Size: 766.5 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pycairo-1.26.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 b93b9e3072826a346f1f79cb1becc403d1ba4a3971cad61d144db0fe6dcb6be8
MD5 541ec73b21ca908a71c17a06d82014c5
BLAKE2b-256 49136279ce219c5735880af7a0b97d3041f106eebf8e7527aad3e4df4e2fcf6d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.26.1-cp39-cp39-win_arm64.whl
  • Upload date:
  • Size: 675.9 kB
  • Tags: CPython 3.9, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pycairo-1.26.1-cp39-cp39-win_arm64.whl
Algorithm Hash digest
SHA256 22e1db531d4ed3167a98f0ea165bfa2a30df9d6eb22361c38158c031065999a4
MD5 2f0619ed90b80a0acef4edb2dee31317
BLAKE2b-256 70010dd13ad12dc840bcbdf313ce5f3658ba8599c33cab87188fa355aafe1a09

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.26.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 862.5 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pycairo-1.26.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 ce049930e294c29b53c68dcaab3df97cc5de7eb1d3d8e8a9f5c77e7164cd6e85
MD5 bff621e9d198499b47945cfda145247d
BLAKE2b-256 9772afe8c322fb58fc66f10061f94d74440c40b9a11c7896c6c47f0fdc5a8556

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.26.1-cp39-cp39-win32.whl
  • Upload date:
  • Size: 766.8 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pycairo-1.26.1-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 e68300d1c2196d1d34de3432885ae9ff78e10426fa16f765742a11c6f8fe0a71
MD5 e46c88acc1856810392c23d3cc775b07
BLAKE2b-256 583f9ddd32ef2ca7af25392df6cc01b8d536f2c6de56a28fd2b3e33eb99a51b2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.26.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 862.5 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pycairo-1.26.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 27357994d277b3fd10a45e9ef58f80a4cb5e3291fe76c5edd58d2d06335eb8e7
MD5 71e5b4fbb600c6f48c38cd722b7ce157
BLAKE2b-256 0934619273df157e839e6754ce2ba44bf95522b5b200e2be0fb9c8106329ca46

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.26.1-cp38-cp38-win32.whl
  • Upload date:
  • Size: 766.8 kB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pycairo-1.26.1-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 27ec7b42c58af35dc11352881262dce4254378b0f11be0959d1c13edb4539d2c
MD5 f06602ce91ab1a63aa8093316de5b888
BLAKE2b-256 0200b72beb131c320fdb23cea8e20cb4a5b38acc6510c2890877a74cdcea484d

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