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.8+ 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.24.0-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3199d6a0538d6482c71efb816bd330515e98bb06f182e23572c77d92be98f536 |
|
MD5 | 57ad680025b751818bca961e018eafda |
|
BLAKE2b-256 | d942537304632ea9f37e14da0b74682c69ca7ea16128308ff2f803312729d4bc |
Hashes for pycairo-1.24.0-cp312-cp312-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 220742f187d3940d695c1af1a0c1646e26dc2199d65b7bafaa527e15c3520fd3 |
|
MD5 | 85ccea20543dff040fd067987137cd56 |
|
BLAKE2b-256 | 4605bfb2f32ae68bab736f9517f83b809f70f8fbe8e03eafc31c4a21a654c6b2 |
Hashes for pycairo-1.24.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed0622a0ccffb873ffe7fee1699d60779f1260fba143390e5366d55f1d1739f5 |
|
MD5 | 5a99cf3e0626c3144676719dd16bf85e |
|
BLAKE2b-256 | 4d80d6a59dbc9e0c4cdc78c94e90959a0da6e461582172efcc5f79602a6d208b |
Hashes for pycairo-1.24.0-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4631ed794a3376ec314ce47826c3e51940b54695f4ef7d5b3245b203037ae760 |
|
MD5 | 33ea5f325a8ccb01b8dd76ab6aeaa13b |
|
BLAKE2b-256 | d3927ba26f9511da487d7e1f2c2961f707956a59b243f00137a3f1916fd31e44 |
Hashes for pycairo-1.24.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | afccac552386ab628e8ae658185fa363e8d15a5afe96d1de43f97027dd78bdd6 |
|
MD5 | 66d8df18c263d47b318dddb9a4b60306 |
|
BLAKE2b-256 | eb7e90d8e3ae3e64e51716543634b84ee05c8e5fed95918b4a641afcd0ddf1e9 |
Hashes for pycairo-1.24.0-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 031f5ef2c80792673f2c54ee285f2a31779a44d7521a27a7f82e4a5ecfafc26e |
|
MD5 | 3579f845f5c862f8a3a41eb0580598bb |
|
BLAKE2b-256 | 226939da108da3fe66516f5d5b2ee2d283079fbe4df4f4d03d6c47faaa945aae |
Hashes for pycairo-1.24.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26fe2c32ba24caae524d855f26f3ee1a0c1ea3291da2a19604264ed29f64d834 |
|
MD5 | 6c518eb64f7a5831a05b4697609f9625 |
|
BLAKE2b-256 | e2bba2c137267fbf526c121de06ca4c65aabcc29a363e2dacb7ccec3994317eb |
Hashes for pycairo-1.24.0-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5f6efdd86fe13d36a6b004c64d8e97cde9854d599cf6cca962afb1966fe533d |
|
MD5 | 5fd0dccf3d86589a5587f03aefbd36bb |
|
BLAKE2b-256 | 93018aec9e17bff2d39bec5a88107664863825d5241c9336e19da47f31c833ef |
Hashes for pycairo-1.24.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ad5c3425408ebb0dfaad2cca4a80e7524d7a309305acdb2569638b5cc988fe7 |
|
MD5 | 37cf1499b67729d43b4345b1ff9fad0c |
|
BLAKE2b-256 | a12ec2d361f1b35b2cdc41c16b6dab4f78ef56e7cc861d4968a47d8612d8326d |
Hashes for pycairo-1.24.0-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7c79e748ec849811241d29553184c3ad93c857558dbe9954a49327680b8d356 |
|
MD5 | 6b527acba294a93331ab56b30bb7b62c |
|
BLAKE2b-256 | 8ed3688dab33f7de05ef9feea640f99bb2607a4112ca134fcdb1300d1000cb32 |