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

Uploaded Source

Built Distributions

pycairo-1.22.0-cp311-cp311-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.11 Windows x86-64

pycairo-1.22.0-cp311-cp311-win32.whl (1.1 MB view details)

Uploaded CPython 3.11 Windows x86

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.10 Windows x86

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

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.9 Windows x86

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8 Windows x86

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m Windows x86

File details

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

File metadata

  • Download URL: pycairo-1.22.0.tar.gz
  • Upload date:
  • Size: 342.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.7

File hashes

Hashes for pycairo-1.22.0.tar.gz
Algorithm Hash digest
SHA256 b34517abdf619d4c7f0274f012b398d9b03bab7adc3efd2912bf36be3f911f3f
MD5 19b0d49b04b5bc179d3df2498836f26d
BLAKE2b-256 e59f541adc3a06ea28369c4ab52d2cf95597bb2ef626b3cf1c61afa26f735461

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycairo-1.22.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b85807ec65a8b7966aca7aa41c39016b72515d6401a874a4b52c314471b31865
MD5 02bbadb2333af160904f49b9822297a1
BLAKE2b-256 f16d6756a36d16eed23675775380dcb653eece5251f6c9fdd8314eddb449f041

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.22.0-cp311-cp311-win32.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.7

File hashes

Hashes for pycairo-1.22.0-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 356c9fc665e8522f497b6cbe026ad8decacbb04c93e13fd5d145956433f3d471
MD5 e252ce473539679196b97e740b2f4cd6
BLAKE2b-256 9d02e227d33d0eae712c56235f50630221bd7a64460e44dacda3bc664fe250e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycairo-1.22.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 62ce5e8c97eeee70170ba9a74845a0ded4bde9b7f1701d88957cbadf8cb1ccd6
MD5 9a3be6d9f4361a0a3c649853dade87d2
BLAKE2b-256 2a7b86454e22654805e74b2db858087ba963ea1c267f06af544059ba7b6cc8e7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.22.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/4.0.1 CPython/3.10.7

File hashes

Hashes for pycairo-1.22.0-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 5a62cf1d2c6339028709a600d83c0c24111feedeef3cf977bca333fbb94a79c8
MD5 412e7ebc48ac4d6d62cf7f6da2e29068
BLAKE2b-256 11fd882a1c9ecd6ac3e81ec038c17bcbedc1deece89fac74c039375b4f00a79b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.22.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/4.0.1 CPython/3.10.7

File hashes

Hashes for pycairo-1.22.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 007ae728c56b9a0962d8c5513ae967a4fceff03e022940383c20f4f3d4c48dbe
MD5 d25f72119328befbfed063de638f5174
BLAKE2b-256 a9ad0847ff86c4259798c0801b37a817a3948e22e88b84c31b76177dfe11cc20

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.22.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/4.0.1 CPython/3.10.7

File hashes

Hashes for pycairo-1.22.0-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 e31a5b70664c425f4d1b71ba8aaf259920de6937a9490132ffabadad2a89764f
MD5 01e3aac9c8712e9b17d24d2d1ffaa39e
BLAKE2b-256 46a9874dbacd73fd193b5ae4ceb019e037867ec1515ef35fb461939857e8042c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.22.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/4.0.1 CPython/3.10.7

File hashes

Hashes for pycairo-1.22.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 e81189414c11340134bffa6dcb06a378976cb87a6742f39aaefc79cb27612250
MD5 073a545399b433c6cffa4990248d9fcb
BLAKE2b-256 974261a07a474920a7847ffb77d1f5a56bd669157a5d61d06fe28e78df1f09b8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.22.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/4.0.1 CPython/3.10.7

File hashes

Hashes for pycairo-1.22.0-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 47aed13e950345c8248f77c8a51bff52188bef7afd3d5169584e0eddc21ba341
MD5 e5c906df86ddac80eca761c2e8e620ef
BLAKE2b-256 ed21088ea95a874fbf1e15106bd953c745580496eb9d39457c0bc5b1d89e3c41

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.22.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/4.0.1 CPython/3.10.7

File hashes

Hashes for pycairo-1.22.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 00c8a6b92c5075ee3be7ea1d33f676d259f11f92cad7e37077dd193437c8c27c
MD5 9f1a4511aef8a74771e0a137d03acaa8
BLAKE2b-256 9c057b30157a1f1d0126e3303819845abdf0ef67a93fb0128206a83cc6474741

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.22.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/4.0.1 CPython/3.10.7

File hashes

Hashes for pycairo-1.22.0-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 9fbe26b3fbe85fde063070e543b4a5f3609569ca8f79680867cecb837d5be29c
MD5 570187e2eae1784abe76fa44cab77b21
BLAKE2b-256 08d3e0d5b1b6c26b3b9fd7e69b21674483180a87b55048fbba0488d19685aa96

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