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.7+ 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
Hashes for pycairo-1.23.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2dec5378133778961993fb59d66df16070e03f4d491b67eb695ca9ad7a696008 |
|
MD5 | dbf4aee80d94dd3001e07a9213eacfeb |
|
BLAKE2b-256 | a690d56b9f827324bbd28f9ca5ff242215a132cabc0e07f64fd69cf48daffe1b |
Hashes for pycairo-1.23.0-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a71f758e461180d241e62ef52e85499c843bd2660fd6d87cec99c9833792bfa |
|
MD5 | 7cc82cb5dbc809d026e7068c7ce7617a |
|
BLAKE2b-256 | 22c266614071e19d82763b2bb8de6260ea96b88d53c65cd8d90f1502b85d9fa7 |
Hashes for pycairo-1.23.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7cde633986435d87a86b6118b7b6109c384266fd719ef959883e2729f6eafae |
|
MD5 | 8aec42833a37a7a643031635f384b2a7 |
|
BLAKE2b-256 | 5b50c3512f7b1158ceb688d5982aa4ca00cb2c863276954f136d66997308cf5b |
Hashes for pycairo-1.23.0-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 564601e5f528531c6caec1c0177c3d0709081e1a2a5cccc13561f715080ae535 |
|
MD5 | 59b285e6b6811942a1702fd8ff5b777d |
|
BLAKE2b-256 | fb9080edc354cda5adc555d29052587d572074bb929cd2a5d1381fb83d3aac2d |
Hashes for pycairo-1.23.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87efd62a7b7afad9a0a420f05b6008742a6cfc59077697be65afe8dc73ae15ad |
|
MD5 | 825f060f16450ce84d83ed3d71b15208 |
|
BLAKE2b-256 | fc934ca3bdda700d33ae6f1dd7213f82905775450c2259e593fd444f6e443f34 |
Hashes for pycairo-1.23.0-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4b1f525bbdf637c40f4d91378de36c01ec2b7f8ecc585b700a079b9ff83298e |
|
MD5 | f1fa8d11195c9ea95f86d0d6a90b6bec |
|
BLAKE2b-256 | b80d8b485c72ee464c533be1f4502b19fe420f6a491c421ccb42aeae6fd7ebaf |
Hashes for pycairo-1.23.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82e335774a17870bc038e0c2fb106c1e5e7ad0c764662023886dfcfce5bb5a52 |
|
MD5 | 236f4732a0ddedd2308463f932ceeab3 |
|
BLAKE2b-256 | 81f7b795802efb84bde14d0143a13843972360d776736a88228edabab1043251 |
Hashes for pycairo-1.23.0-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a6d8e0f353062ad92954784e33dbbaf66c880c9c30e947996c542ed9748aaaf |
|
MD5 | 0196063b357c5e7e8ca32d4186fe1132 |
|
BLAKE2b-256 | 3b647841f74b66de97c2527dc937a35356dfd09b44da791ec16e44e326a0cb52 |
Hashes for pycairo-1.23.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec305fc7f2f0299df78aadec0eaf6eb9accb90eda242b5d3492544d3f2b28027 |
|
MD5 | 713c50ae5886f36eabd26c3518bd2e49 |
|
BLAKE2b-256 | 282ea08b0dd51bcd9ddd536ad4d133ffa1850f98072cca858b385dc116944867 |
Hashes for pycairo-1.23.0-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6bacff15d688ed135b4567965a4b664d9fb8de7417a7865bb138ad612043c9f |
|
MD5 | f663c9bbb9bdaca9f7e88bf5be5e4d4d |
|
BLAKE2b-256 | d2f3390c7730777e5fc1bc1a2da3ba02de95e7cc254a335889c3da7386d6e6e3 |