A library for creating SVG drawings using Python.
Its usage and most of the public API (and obviously its name, too) is strongly inspired by Raphaël JavaScript Library. Some examples and some of the implementation details are borrowed from the original project, too.
See examples to examine how to it works and how to use it.
The package works with both Python 2 and 3 (tested on Ubuntu 18.04 LTS and Python 2.7.15 and Python 3.6.6).
as simple as:
from raphaelpy import Raphael
# Creates canvas 320 x 200 at 10, 50
paper = Raphael("drawing.svg", 320, 200)
# Creates circle at x = 50, y = 40, with radius 10
circle = paper.circle(50, 40, 10)
# Sets the fill attribute of the circle to red (#f00)
circle.attr("fill", "#f00")
# Sets the stroke attribute of the circle to blue
circle.attr("stroke", "#00f")
# Saves the resulting drawing to the file
paper.save()
See examples directory for more examples.
-
Using
setup.py
file:python setup.py install [options]
, e.g.python setup.py --user
-
Using
make
(callssetup.py
internally):make install [options]
, e.g.make install USER=TRUE PYTHON=python3
-
Using
pip
[sudo] pip[3] install [options] raphaelpy
, e.g.pip install --user raphaelpy
orsudo pip3 install raphaelpy
Note: use
pip
of Python 2 andpip3
for Python 3
directory | content |
---|---|
raphaelpy | source code |
examples | examples how RaphaëlPy works and how to use it |
Makefile | makefile for the project (with targets help , install , doc , test , clean , dist ) |
docs | source codes to build HTML documentation |
tests | a few unit tests |
setup.py | python setup file for installation |
Are welcome.
In case of any question or problem, please leave an issue at the githup page of the project.
This project is licensed under the LGPL License - see the license file for details.
- to Raphaël JavaScript Library for great job and inspiration.