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 details)
File details
Details for the file ScalableWriter-1.2.1.tar.gz
.
File metadata
- Download URL: ScalableWriter-1.2.1.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb9d2c01adc7485c118baba34dfd8ffe5b4ccc08a5ee6ad7aa256c02d5023a88 |
|
MD5 | 4065c664f693d677d9ba0d3b903c0d25 |
|
BLAKE2b-256 | b01a2261f852e2218d3d847e6b62c873264a72fb953ea225846f6172f43ed6e5 |