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.25.1-cp312-cp312-win_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27011d822952d7817130fc17f490de94328590bc8d45bdbca9ec4a47039fca22 |
|
MD5 | d602fc20fcbfef88b24b87e5c8c7c011 |
|
BLAKE2b-256 | 30f4357a8563ecb83aa200d30a43c5f44bbbe774d488bbd49da22e2ce446bd80 |
Hashes for pycairo-1.25.1-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb31eec2c41ec74e23dc0fc9feb4007b4c37f78ec76220ed92530b342e09821a |
|
MD5 | fff0bec1411be292a62809a11ea1b272 |
|
BLAKE2b-256 | 59e6dae72672b0a04a0bc848c14e550f3330770e1d09bd61266cfb5bda40b22b |
Hashes for pycairo-1.25.1-cp312-cp312-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56fee2837a07ecd914f4fbf78ff59445f78becd658fe36125101925dd489eb94 |
|
MD5 | b261509e5a85f3dc8bd1d4429d98155b |
|
BLAKE2b-256 | 9c384c591811a799a9a7706dbe1ddc49a710a7d5ba8c227ce3e90b99beb773cb |
Hashes for pycairo-1.25.1-cp311-cp311-win_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4133ba3ef6d875aa1b16643dc0801846f463b8e78750f5308c41902dfeac5b9a |
|
MD5 | 25f2a891ef799241285be1dc5002bd8b |
|
BLAKE2b-256 | 85eb9b0438b7143578a6e1188ad0407227e029f30b137764ca58b58b6ec1df2b |
Hashes for pycairo-1.25.1-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcf5511b05a652a0ef87f626bf26bfc1b796a67f0d1bd40781c62986fb41c356 |
|
MD5 | 357526346ba77355d7d64c1dc706dca0 |
|
BLAKE2b-256 | fed2f1712b8b36a7e9ba06a4ee00f538e45b9845165d0cb786242d3c76bafc93 |
Hashes for pycairo-1.25.1-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b10e58a3ce41e487aae15050b630742e880d4135cee7a69cee2c0ea2a0b4bd0a |
|
MD5 | d52e9af4432ae7f2268fdfa2b1688a02 |
|
BLAKE2b-256 | 1cb89b03f9ea00aa6cf84cde50aea1a392ede04c08b9139858be5b54589a8fea |
Hashes for pycairo-1.25.1-cp310-cp310-win_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b19269a8bf9ab5e3c617f2699bed00977fd02ff304339a233654456c0236f7c6 |
|
MD5 | 79b7bf16d406e16e01163e1a8d337193 |
|
BLAKE2b-256 | ef338c0016f6839cd721a72a18efb96c517c7f844fd13c40e19ab2b56a37c036 |
Hashes for pycairo-1.25.1-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 109ebbeb5bbc510b726fc31251071264dec241e5084d0668f846d7e17e5af8e0 |
|
MD5 | d6f98a08b364c02c26de2253fff5ff01 |
|
BLAKE2b-256 | efca3fe90655180f19028335c51999089ee82f69716ac8dba42d710601f1ae2b |
Hashes for pycairo-1.25.1-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cacb5c2abbfdfc79c728ab261ff791511e4957b606c660f9b380975b678b728f |
|
MD5 | eae597e7a4823de35f478e712aa086d8 |
|
BLAKE2b-256 | 852b9dc5c8e5a5abae827d9ced97f91bd13700c2b35f62d72b2bb3358be4598b |
Hashes for pycairo-1.25.1-cp39-cp39-win_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bda5d10adbf1f5eba6b524b5a70ccf7f659680b77e691ff94b312f25a6fcc91f |
|
MD5 | ff004e5f7eefe3b21d354a7443099e19 |
|
BLAKE2b-256 | c21b27d80b50dc09289509a9ffeb7fe412e27c6d75d9e450cf119b3a1b286777 |
Hashes for pycairo-1.25.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac5437d140eccd97af12a618cc1ace0d9a85f1269f29e963751949f132828b21 |
|
MD5 | ff71cd532e7dc262dfb51932dd8758f0 |
|
BLAKE2b-256 | f76e7c171090a5efcb4edc83b7d247463e0831b73bde52c140e87fabb479276e |
Hashes for pycairo-1.25.1-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97666c084e9eb1c08c7fd6d306d153767acdf03c0d80349ec55863cecd4138e0 |
|
MD5 | dabd69a270cfb585fcf3718dc949edfd |
|
BLAKE2b-256 | ff2c8d98acf1cae32ad37b8aed109bca4808f67c3046dc798f7800540c27ba23 |
Hashes for pycairo-1.25.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48603ad31616140ad6fa097f13086d0ce8f29ead35ad6a215962f3b0496a5a70 |
|
MD5 | 6135b2316b98a097d08b10f6810e870d |
|
BLAKE2b-256 | 4676366ee693939e89f24422b3d3805f4f68c2bd07a4ee2fb309c8ed9730c981 |
Hashes for pycairo-1.25.1-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a7c5ed92fe87f60e9796777d5255f2df2deeb8ab1e3c296e67a1d8c9790808c |
|
MD5 | 904d4e220750298ed8914640d138902b |
|
BLAKE2b-256 | 15c19472d51cc0e2ca72decc7cb406c926a36758fa86333034b8c370e65af0e3 |