受rapha_ljs启发,使用python创建svg图形的库
raphaelp的Python项目详细描述
RaphaëlPy
使用python创建svg图形的库。
概述
它的使用和大多数公共api(当然还有它的名字)都受到了Raphaël JavaScript Library的强烈启发。 一些示例和一些实现细节也是从原始项目中借用的。
请参阅examples以检查它如何工作以及如何使用它。
兼容性
这个包同时适用于python 2和3(在Ubuntu 18.04 LTS和python2.7.15以及python 3.6.6上测试)。
用法
简单到:
fromraphaelpyimportRaphael# Creates canvas 320 x 200 at 10, 50paper=Raphael("drawing.svg",320,200)# Creates circle at x = 50, y = 40, with radius 10circle=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 bluecircle.attr("stroke","#00f")# Saves the resulting drawing to the filepaper.save()
有关更多示例,请参见examples目录。
安装
使用
setup.py
文件:python setup.py install [options]
,例如python setup.py --user
使用
make
(内部调用setup.py
):make install [options]
,例如make install USER=TRUE PYTHON=python3
使用^{
} [sudo] pip[3] install [options] raphaelpy
,例如pip install --user raphaelpy
或sudo 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 ^{ |
docs | source codes to build HTML documentation |
tests | a few unit tests |
setup.py | python setup file for installation |
贡献
拉取请求
很受欢迎。
错误报告
如有任何疑问或问题,请在githup page of the project留言。
贡献者
许可证
此项目是根据lgpl许可证授权的-有关详细信息,请参见license file。
致谢
- 为了伟大的工作和灵感。