Python interface for cairo
Project description
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()
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file pycairo-1.27.0.tar.gz
.
File metadata
- Download URL: pycairo-1.27.0.tar.gz
- Upload date:
- Size: 661.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5cb21e7a00a2afcafea7f14390235be33497a2cce53a98a19389492a60628430 |
|
MD5 | 12097575a1bb683cab7dc425d9769a68 |
|
BLAKE2b-256 | 074a42b26390181a7517718600fa7d98b951da20be982a50cd4afb3d46c2e603 |
File details
Details for the file pycairo-1.27.0-cp313-cp313-win_amd64.whl
.
File metadata
- Download URL: pycairo-1.27.0-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 844.1 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0349d744c068b6644ae23da6ada111c8a8a7e323b56cbce3707cba5bdb474cc |
|
MD5 | f615839b07f4880c0862aa3381744ae0 |
|
BLAKE2b-256 | 9ce792d6e57deee53229bb8b3f7df6d02c503585be7bdd69cb9e54f34aab089b |
File details
Details for the file pycairo-1.27.0-cp313-cp313-win32.whl
.
File metadata
- Download URL: pycairo-1.27.0-cp313-cp313-win32.whl
- Upload date:
- Size: 750.0 kB
- Tags: CPython 3.13, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01505c138a313df2469f812405963532fc2511fb9bca9bdc8e0ab94c55d1ced8 |
|
MD5 | 7bac191cf61f2c1fca13ad6bdfe37dac |
|
BLAKE2b-256 | 937635d2feef50584cb00d2b4d2215337b0bc765508f8856735a41bfedcb4699 |
File details
Details for the file pycairo-1.27.0-cp312-cp312-win_amd64.whl
.
File metadata
- Download URL: pycairo-1.27.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 844.1 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27cb4d3a80e3b9990af552818515a8e466e0317063a6e61585533f1a86f1b7d5 |
|
MD5 | 3385a428cec68d7b651ee01586bca081 |
|
BLAKE2b-256 | f4bd114597b9f79fbdb4eb0a4bf4aa54e70246d87f512a880e66a85c1e2ff407 |
File details
Details for the file pycairo-1.27.0-cp312-cp312-win32.whl
.
File metadata
- Download URL: pycairo-1.27.0-cp312-cp312-win32.whl
- Upload date:
- Size: 750.0 kB
- Tags: CPython 3.12, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2239b9bb6c05edae5f3be97128e85147a155465e644f4d98ea0ceac7afc04ee |
|
MD5 | a8360297044c4e2a45fcf3622c6fcca4 |
|
BLAKE2b-256 | 1c657664fe3d9928572b7804c651a99cfd6113338eee7436d5b25401c9382619 |
File details
Details for the file pycairo-1.27.0-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: pycairo-1.27.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 844.1 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d40a6d80b15dacb3672dc454df4bc4ab3988c6b3f36353b24a255dc59a1c8aea |
|
MD5 | fd94d9e7bab8511f0a999ccb35bfb4e5 |
|
BLAKE2b-256 | 90d2ae7c781ceaac315e7c80381f83dc779a591bde6892e3498c7b5f42ec6cb8 |
File details
Details for the file pycairo-1.27.0-cp311-cp311-win32.whl
.
File metadata
- Download URL: pycairo-1.27.0-cp311-cp311-win32.whl
- Upload date:
- Size: 749.8 kB
- Tags: CPython 3.11, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a9b79f92a434dae65c34c830bb9abdbd92654195e73d52663cbe45af1ad14b2 |
|
MD5 | c91ba84566951c962c23c460bccd5e3b |
|
BLAKE2b-256 | 3b4bd7887904e10673ff8d99aaa2e63f82b245441261ea29136254576ac1c730 |
File details
Details for the file pycairo-1.27.0-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: pycairo-1.27.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 844.1 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03bf570e3919901572987bc69237b648fe0de242439980be3e606b396e3318c9 |
|
MD5 | bc1786f74303bc90cf6771219b4e8c4e |
|
BLAKE2b-256 | fcca6fa943f96fcee3655bdbf571e788927487f18fb6fef4787040473151b153 |
File details
Details for the file pycairo-1.27.0-cp310-cp310-win32.whl
.
File metadata
- Download URL: pycairo-1.27.0-cp310-cp310-win32.whl
- Upload date:
- Size: 749.8 kB
- Tags: CPython 3.10, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e20f431244634cf244ab6b4c3a2e540e65746eed1324573cf291981c3e65fc05 |
|
MD5 | 1a515a734989f1ee05016f4305773f3c |
|
BLAKE2b-256 | a900bfc1a76728a5e7be0fc3c666babf4e9d916834080551d2b1ba4a32732592 |
File details
Details for the file pycairo-1.27.0-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: pycairo-1.27.0-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 844.5 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b1321652a6e27c4de3069709b1cae22aed2707fd8c5e889c04a95669228af2a |
|
MD5 | 334db8e734e52005c09856f85a4b23dc |
|
BLAKE2b-256 | 36b1d0cd9de2faf57d3ec6299ab0f80fd06e7bd94869356773d87045ef25ddcb |
File details
Details for the file pycairo-1.27.0-cp39-cp39-win32.whl
.
File metadata
- Download URL: pycairo-1.27.0-cp39-cp39-win32.whl
- Upload date:
- Size: 750.0 kB
- Tags: CPython 3.9, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9ca8430751f1fdcd3f072377560c9e15608b9a42d61375469db853566993c9b |
|
MD5 | fcad1ca1b800546f22d485a9472d194b |
|
BLAKE2b-256 | 4ab0304a04ee7b6d2aef031c70e8f732151b4cbef3c3b6e2881283b2d68de17a |