one-file-projects/piart.py

25 lines
571 B
Python
Raw Normal View History

2015-04-22 18:33:54 +02:00
import svgwrite as svg
import random
def randomcolor():
r = random.randint(100,200)
g = random.randint(100,200)
b = random.randint(100,200)
return "#%02X%02X%02X" % (r,g,b)
dg = svg.Drawing('piart.svg', size=(1920,1080), profile="full")
#Background
bg = dg.add(dg.g(id='background', fill='#2C2E2F'))
bg.add(dg.rect(insert=(0,0),size=(u'100%',u'100%'),rx=0,ry=0))
#circle
circle = dg.add(dg.g(id='circle'))
for x in range(1,111):
for y in range(1,62):
circle.add(dg.circle(center=(10+5+x*17,10+5+y*17),r=5,fill=randomcolor()))
dg.save()