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.6+. 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.20.0.tar.gz (344.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pycairo-1.20.0-cp39-cp39-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.9Windows x86-64

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

Uploaded CPython 3.9Windows x86

pycairo-1.20.0-cp38-cp38-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.8Windows x86-64

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

Uploaded CPython 3.8Windows x86

pycairo-1.20.0-cp37-cp37m-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.7mWindows x86-64

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

Uploaded CPython 3.7mWindows x86

pycairo-1.20.0-cp36-cp36m-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.6mWindows x86-64

pycairo-1.20.0-cp36-cp36m-win32.whl (1.1 MB view details)

Uploaded CPython 3.6mWindows x86

File details

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

File metadata

  • Download URL: pycairo-1.20.0.tar.gz
  • Upload date:
  • Size: 344.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.4.2 requests/2.23.0 setuptools/49.3.1 requests-toolbelt/0.8.0 tqdm/4.48.2 CPython/3.8.6

File hashes

Hashes for pycairo-1.20.0.tar.gz
Algorithm Hash digest
SHA256 5695a10cb7f9ae0d01f665b56602a845b0a8cb17e2123bfece10c2e58552468c
MD5 a1f9b661a0000c2f42281db933284451
BLAKE2b-256 9d6e499d6a6db416eb3cdf0e57762a269908e4ab6638a75a90972afc34885b91

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.20.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.4.2 requests/2.23.0 setuptools/49.3.1 requests-toolbelt/0.8.0 tqdm/4.48.2 CPython/3.8.6

File hashes

Hashes for pycairo-1.20.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 57166119e424d71eccdba6b318bd731bdabd17188e2ba10d4f315f7bf16ace3f
MD5 fb4ee60df8f8165e758795fe3c401656
BLAKE2b-256 0fc990de361de52dc2d801f78ec204e369dde9427ea8dffdb8dea4124eccb722

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.20.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.2.0 pkginfo/1.4.2 requests/2.23.0 setuptools/49.3.1 requests-toolbelt/0.8.0 tqdm/4.48.2 CPython/3.8.6

File hashes

Hashes for pycairo-1.20.0-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 57a768f4edc8a9890d98070dd473a812ac3d046cef4bc1c817d68024dab9a9b4
MD5 15265ca8b68c76d90e331b0850846279
BLAKE2b-256 56bd5b3a6c35849ece9f9dde24d6c728a07d98240b3a2424001751a76e169fa0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.20.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.4.2 requests/2.23.0 setuptools/49.3.1 requests-toolbelt/0.8.0 tqdm/4.48.2 CPython/3.8.6

File hashes

Hashes for pycairo-1.20.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 ceb1edcbeb48dabd5fbbdff2e4b429aa88ddc493d6ebafe78d94b050ac0749e2
MD5 44bd1d1e540b1f35a3518b099b55a64f
BLAKE2b-256 0194b16f92f4aac89739cb31243bcf4346d2c5ef468db982804ff378e9712589

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.20.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.2.0 pkginfo/1.4.2 requests/2.23.0 setuptools/49.3.1 requests-toolbelt/0.8.0 tqdm/4.48.2 CPython/3.8.6

File hashes

Hashes for pycairo-1.20.0-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 2088100a099c09c5e90bf247409ce6c98f51766b53bd13f96d6aac7addaa3e66
MD5 9fa00e23ca380562f211f3a6085a5cf2
BLAKE2b-256 eedeeff070f261a4ae2d3ea4fea99ce5e65ada4c631e37cbb3143028d7072ac8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.20.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.4.2 requests/2.23.0 setuptools/49.3.1 requests-toolbelt/0.8.0 tqdm/4.48.2 CPython/3.8.6

File hashes

Hashes for pycairo-1.20.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 273a33c56aba724ec42fe1d8f94c86c2e2660c1277470be9b04e5113d7c5b72d
MD5 959638625afe8f6050dea9f299364df9
BLAKE2b-256 af7da3db6ae07d90faa5304f9687add30bffa76174919cd83f6df28f53c8504f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycairo-1.20.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.2.0 pkginfo/1.4.2 requests/2.23.0 setuptools/49.3.1 requests-toolbelt/0.8.0 tqdm/4.48.2 CPython/3.8.6

File hashes

Hashes for pycairo-1.20.0-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 8cfa9578b745fb9cf2915ec580c2c50ebc2da00eac2cf4c4b54b63aa19da4b77
MD5 4913b916967c61d21b42bbe46845af70
BLAKE2b-256 c650e0776e26f700ed17473fe6d47910e100fcfe92ecc83ac285071b5f65738b

See more details on using hashes here.

File details

Details for the file pycairo-1.20.0-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: pycairo-1.20.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.4.2 requests/2.23.0 setuptools/49.3.1 requests-toolbelt/0.8.0 tqdm/4.48.2 CPython/3.8.6

File hashes

Hashes for pycairo-1.20.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 a942614923b88ae75c794506d5c426fba9c46a055d3fdd3b8db7046b75c079cc
MD5 7f4080ef71509569c6504e3713e4dc01
BLAKE2b-256 247c02c1b6607fa31ad448133633b60f7a861f1c094eaa49c7139e41474b3c10

See more details on using hashes here.

File details

Details for the file pycairo-1.20.0-cp36-cp36m-win32.whl.

File metadata

  • Download URL: pycairo-1.20.0-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.6m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.4.2 requests/2.23.0 setuptools/49.3.1 requests-toolbelt/0.8.0 tqdm/4.48.2 CPython/3.8.6

File hashes

Hashes for pycairo-1.20.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 e5a3433690c473e073a9917dc8f1fc7dc8b9af7b201bf372894b8ad70d960c6d
MD5 d29fb6b3618686e64663c97d3b7fe75a
BLAKE2b-256 8f2df04b70944f2a0ae496a4ff3c89f613a2cdf1c5c969e89ae317ddc3dde9cd

See more details on using hashes here.

Supported by

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