Table of Contents

SVG

Software

Aufgaben

Codes

SVG in HTML eingebettet:

svginhtml.py
with open("test.html", "w") as file:
    file.write('<html><body><h1>My first SVG</h1><svg width="800" height="800">\n')
 
    for i in range(30):
        file.write('<circle cx="%d" cy="%d" r="%d" stroke="green" stroke-width="2" fill="none" />\n' % (i*5, i*5, i*2))
 
    file.write('</svg></body></html>')

SVG als alleinstehende Datei:

standalonesvg.py
with open("test.svg", "w") as file:
    file.write('<?xml version="1.0"?><svg xmlns="http://www.w3.org/2000/svg" width="800" height="800">\n')
 
    for i in range(30):
        file.write('<circle cx="%d" cy="%d" r="%d" stroke="green" stroke-width="2" fill="none" />\n' % (i*5, i*5, i*2))
 
    file.write('</svg>')