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.0-cp312-cp312-win_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8690cc2cba6bd223cc9703a9a7b392fe1bec78003662c6dbc9869d81ee343bdf |
|
MD5 | 34887ebc1d358bc2bbbfe9e0ebe47cdf |
|
BLAKE2b-256 | 7075300f3cfefd64ec56f3fac509697d628d42f0d6cb9bc3efdaa81b34e330ef |
Hashes for pycairo-1.25.0-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec0e05fe7a0d2fc1ef0d6babc19b8b2d731af3ab1638fcdcaad2d42204a487f2 |
|
MD5 | 87dc5b6c435e41d80c1f306028844870 |
|
BLAKE2b-256 | 74084062c03d06633a7ca418c7f4a9d7495d314773680a4988842ea0c41fb726 |
Hashes for pycairo-1.25.0-cp312-cp312-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | caa76409cae523f7c5254ee75935d8d520efa96eaf22c64f26c8e24ca74f8281 |
|
MD5 | 14270fdae5438487fe7d407da1a01d12 |
|
BLAKE2b-256 | e2a7769f43df0c3ebbb9676dc365bd7e55a7c70a9536fe57dff35040ddd27b30 |
Hashes for pycairo-1.25.0-cp311-cp311-win_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6654201d10c5f13975caec648796b1e0e2b0f8af1e4302a086dc3183bb8346ee |
|
MD5 | ccacf10dffd204226f7f875e7771984a |
|
BLAKE2b-256 | 544423568358740e1516710137cc71c636ee556af4fb6466421eb4548a266b9d |
Hashes for pycairo-1.25.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c40ce034a07266460bc3318a179aa43b2824d36754906831a90c99fb4f246370 |
|
MD5 | f177bced02f4772b845433af73887b14 |
|
BLAKE2b-256 | c6002161c54845134cc08cd88ff78599e1665bc6e2d02648ee2e38d57b9ed21f |
Hashes for pycairo-1.25.0-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e4da8be0a696c2e8a1709f5a2bd849e802147769439ea4268f926695f4b5a55 |
|
MD5 | 2b75ab8015427326dfedece035686e3e |
|
BLAKE2b-256 | ce26602bea4c189f41767e3f1d2978360ac559aaa834bf1eda02edb9496999d3 |
Hashes for pycairo-1.25.0-cp310-cp310-win_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f1390e5e81719bfcf30ad667c09188caa1d3bd190f9af40efcd13e25b7cf25b |
|
MD5 | 4834ed92c34f7ce48bcc2df1476a7fdd |
|
BLAKE2b-256 | 4e51872ff918399ebe75b8abf31599c432f398b41b544222054035f1e00b6075 |
Hashes for pycairo-1.25.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5d29720075d0d3cc1eef8abb3a3069951b466f04583976adfd770e71bc5be3a |
|
MD5 | af783f695e817df5348c157e927d5530 |
|
BLAKE2b-256 | 427c1490eb1032c017c7e47a52c72a2d6577159993334e9e89836b1001885951 |
Hashes for pycairo-1.25.0-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8b08f198a45b5e505c1475ed9c3b1a39993b9ebff0e18dd9f194927de6411b7 |
|
MD5 | 1cea29e20944be9b71e72a7b6aefaee4 |
|
BLAKE2b-256 | 7fc0ec4c59cb1eeeb3b108d07381a8bf127a4b36f04c7efbcb26ac6569df8a24 |
Hashes for pycairo-1.25.0-cp39-cp39-win_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c986f7ee44dee9c6b119604f8f33480d9f5410e550a8bbda5d333742a867a53c |
|
MD5 | b32376755d781bd8b9e980e0a173ef30 |
|
BLAKE2b-256 | 82de6b0700ff336a91632ef383d4e13c2f4164f44ac482bc25bc4888b875b404 |
Hashes for pycairo-1.25.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1eb0fe7738e770057017f185a76aaad9aa280da1bdf0571fb85b7e116eeb3001 |
|
MD5 | b8ef99f2cec24a5ec1065247c34399d5 |
|
BLAKE2b-256 | 8c8aa7762def4a908fec6afa446ea8dbf020f34e9f15c24ac5fe77f6b1eb8947 |
Hashes for pycairo-1.25.0-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 659b0b701767bbfe16ad3cb291717039555bf4d0b857f64acc7e40e1b39660bc |
|
MD5 | 8b91fbd7d52a056fd5276e63522b9f3f |
|
BLAKE2b-256 | e8a5114c3b38c8714de8770a853149f3e320f6305e7e296a2ff732607b9bf02b |
Hashes for pycairo-1.25.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f0ee34c6ca1e7ef970d51fb68e5a6a02a374d2e679ceddf891dfc53408b11c7 |
|
MD5 | 6b007669025d06c923d4549b7e4fa262 |
|
BLAKE2b-256 | 4b01d6d56096cf2bf9005930e8d3301d46dfbc444bac2c6fef512d856f346e1e |
Hashes for pycairo-1.25.0-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 439c62c3c744aabb70ab6b97f04e0d58e587cc35c2e9f52d1bb2f47f852ea2de |
|
MD5 | 269f7cdbca97edc363e0eae4256856f5 |
|
BLAKE2b-256 | 8545a5d43173d98ae461603c5576934e55fa0db20f6b0ab52dd85f1d48742fb2 |