Skip to main content

Python interface for cairo

Project description

https://raw.githubusercontent.com/pygobject/pycairo/master/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.7+. 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”.


https://raw.githubusercontent.com/pygobject/pycairo/master/docs/images/example.svg
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()

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.

If Pycairo is not what you need, have a look at cairocffi, which is an API compatible package using cffi or Qahirah, which is using ctypes and provides a more “pythonic” API with less focus on matching the cairo C API.

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

https://codecov.io/gh/pygobject/pycairo/branch/master/graph/badge.svg

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

Uploaded Source

Built Distributions

pycairo-1.21.0-cp310-cp310-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.10 Windows x86-64

pycairo-1.21.0-cp310-cp310-win32.whl (1.1 MB view details)

Uploaded CPython 3.10 Windows x86

pycairo-1.21.0-cp39-cp39-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.9 Windows x86-64

pycairo-1.21.0-cp39-cp39-win32.whl (1.1 MB view details)

Uploaded CPython 3.9 Windows x86

pycairo-1.21.0-cp38-cp38-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.8 Windows x86-64

pycairo-1.21.0-cp38-cp38-win32.whl (1.1 MB view details)

Uploaded CPython 3.8 Windows x86

pycairo-1.21.0-cp37-cp37m-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.7m Windows x86-64

pycairo-1.21.0-cp37-cp37m-win32.whl (1.1 MB view details)

Uploaded CPython 3.7m Windows x86

File details

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

File metadata

  • Download URL: pycairo-1.21.0.tar.gz
  • Upload date:
  • Size: 340.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/24.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.2

File hashes

Hashes for pycairo-1.21.0.tar.gz
Algorithm Hash digest
SHA256 251907f18a552df938aa3386657ff4b5a4937dde70e11aa042bc297957f4b74b
MD5 682238eaa8bd7032e36a20b6f53824d1
BLAKE2b-256 92a4506564f574fa74c90b98690e8ecc8dbae1629f31fcfe0be69de45d9e1605

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.21.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/24.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.2

File hashes

Hashes for pycairo-1.21.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f63c153a9ea3d21aff85e2caeee4b0c5d566b2368b4ed64826020d12953d76a4
MD5 cc5a1387f3fc7e96259735e35d1e4066
BLAKE2b-256 39376e30254f6583a8ecf6f8a103af48ef5f8c97f56bbe94cf69af6f5f80729c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.21.0-cp310-cp310-win32.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/24.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.2

File hashes

Hashes for pycairo-1.21.0-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 44a2ecf34968de07b3b9dfdcdbccbd25aa3cab267200f234f84e81481a73bbf6
MD5 282226b27d01a45ac7d203eb3159d3c9
BLAKE2b-256 9da4783deb9a62eb4417f2660dba97de7e3c8e22f6a9840aea294679b172ba10

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.21.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/24.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.2

File hashes

Hashes for pycairo-1.21.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 26b72b813c6f9d495f71057eab89c13e70a21c92360e9265abc049e0a931fa39
MD5 415bbe70e03a15c8798ffd1b5147e385
BLAKE2b-256 c51573cdbade21b101e679a344c519e402948dadbc159e03bef6738317e8c2c4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.21.0-cp39-cp39-win32.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/24.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.2

File hashes

Hashes for pycairo-1.21.0-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 6d37375aab9f2bb6136f076c19815d72108383baae89fbc0d6cb8e5092217d02
MD5 5c013b2b6c51d2732430dafad2bdf60f
BLAKE2b-256 f14ce9149c9135ad0644b906f7890fd70502bd01f95b12e4dddfa39784826c0d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.21.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/24.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.2

File hashes

Hashes for pycairo-1.21.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 4357f20a6b1de8f1e8072a74ff68ab4c9a0ae698cd9f5c0f2b2cdd9b28b635f6
MD5 b5e4e429b62ea4a1cfaabd703c1f8117
BLAKE2b-256 bc0a62f8f61cceeec8b717b96d8773da5b2897ed6017206e1360f1694fac5e62

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.21.0-cp38-cp38-win32.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/24.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.2

File hashes

Hashes for pycairo-1.21.0-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 dace6b356c476de27f8e1522428ac21a799c225703f746e2957d441f885dcb6c
MD5 b029488101b1f1012f9991fa81cc8a52
BLAKE2b-256 012cb26441fa33a8beb905bb893eb5368b6b2c713a0edd5284356c6f4cffd863

See more details on using hashes here.

File details

Details for the file pycairo-1.21.0-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: pycairo-1.21.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/24.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.2

File hashes

Hashes for pycairo-1.21.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 31e1c4850db03201d33929cbe1905ce1b33202683ebda7bb0d4dba489115066b
MD5 78b9c4248786635341fa3b570a89e0d4
BLAKE2b-256 482d1c040c138201d4c20e426ed7edbc4baead044e6b1706858d1fe3fdd3fc56

See more details on using hashes here.

File details

Details for the file pycairo-1.21.0-cp37-cp37m-win32.whl.

File metadata

  • Download URL: pycairo-1.21.0-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/24.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.2

File hashes

Hashes for pycairo-1.21.0-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 70936b19f967fa3cb3cd200c2608911227fa5d09dae21c166f64bc15e714ee41
MD5 dfef1d4fc599c964abe74acbf6b497b8
BLAKE2b-256 5d260d193f24c683edf71864a28d87e19f0015c2c639bf9dd0cc2b96c4a8b18e

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