Generate SVG code on a programmatic way.
Project description
ScalableWriter
ScalableWriter is a small library which can generate SVG code.
Install
# PIP
pip install ScalableWriter
# GIT+PIP
pip install git+https://github.com/ZSendokame/Scalable.git
Use
import scalable
# Specify output file, it also accepts a width and height arguments.
svg = scalable.SVG('chess.svg', width=600)
y = 10
x = 10
color = False
for row in range(8):
for rectangle in range(8):
rectangle_color = 'white' if not color else 'black'
color = not color
# The functions accept every keyword, translating them into SVG.
svg.rectangle(
height=30, width=30, x=x * 3, y=y,
stroke='black', fill=rectangle_color
)
x += 10
color = not color if rectangle == 7 else color
x = 10
y += 30
# Save file.
svg.save()
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
ScalableWriter-1.2.1.tar.gz
(3.2 kB
view hashes)