Pookkalam by Kiran Koshy

Code

#grid
def make_grid(n):
    width = 800
    d = width/n
    xstart = -width/3 + d/3
    ystart = width/3 - d/3
    shapes = []
    for i in range(n):
        for j in range(n):
            x = xstart + d*j
            y = ystart - d*i
            shape = make_shape(d) | translate(x=x, y=y)
            shapes.append(shape)
    return combine(shapes)
# make the shape of given width at position (x, y)
def make_shape(width):
    return rectangle(w=width,h=width, fill="#993300", stroke="white")
shape = make_grid(10)
show(shape)
#outer part
t1 = circle(r=135,fill ="green" )
t2 = circle(x=40, y=0, r=95, fill="#ffa31a") | repeat(6, rotate(60))
t3 = circle(r=128, fill = "red")
t4 = rectangle(w=185, h=185, fill="white") | repeat(9, rotate(80))
t5 = circle(r=115, fill="red")
t6 = circle(x=50, y=0, r=65, fill="purple",stroke="none") | repeat(6, rotate(65))
show(t1,t2,t3,t4,t5,t6)
#
k1 = circle(x=60,y=60,r=15,fill="#cc0066",stroke="#ffa31a") |repeat(6,rotate(60))
k3 = circle(x=60,y=60,r=3,fill="white",stroke="#ffa31a") |repeat(6,rotate(60))
f1 = ellipse(w=3,h=22,fill="#ffa31a")| repeat(6,rotate(30))| translate(x=60,y=60)
f2 = f1|repeat(6,rotate(60)) 
show(k1,f1,f2,k3)
#
p1 = point(x=0, y=80)
p2 = point(x=-80, y=0)
p3 = point(x=-80, y=80)
p4 = polygon([p1, p2, p3], fill= "#990033",stroke="yellow")|repeat(6, rotate(60))
show(p4)
q1 = point(x=0, y=70)
q2 = point(x=-70, y=0)
q3 = point(x=-70, y=70)
q4 = polygon([q1, q2, q3], fill= "#ff8000",stroke="none")|repeat(6, rotate(60))
show(q4)
#
s1 = ellipse(x=20, y=69, w=14, h=30, fill="#cc4400",stroke="none") |repeat(12, rotate(60))
s3= circle(x=20, y=64, r=2,fill="yellow",stroke="none")|repeat(12, rotate(60))
show(s1)
z1 = point(x=26, y=75)
z2 = point(x=8, y=75)
z3 = point(x=25, y=90)
shape = polygon([z1, z2, z3], fill="#cc4400",stroke="none")|repeat(12,rotate(60))
show(shape)
g1 = ellipse(w=3,h=17,fill="green")| repeat(6,rotate(30))| translate(x=20,y=64)
g2 = g1|repeat(6,rotate(60)) 
show(g1,g2,s3)
s4 =rectangle(w=80, h=80,fill ="green")|repeat(2,rotate(60))
s5 = rectangle(w=85, h=85, fill="#ffa31a")|repeat(2,rotate(60))
c1 = circle(r=40,fill="red")
show(s5,s4,c1)
#flower
r0 = circle(x=20, y=0, r=20,fill="#660066")+circle(x=20, y=0, r=16,fill="#ffa31a")+circle(x=20, y=0, r=14,fill="#660066")
r1 = r0 |repeat(6, rotate(60))
r2 = circle(r=4,fill="white")
r3 = ellipse(w=10, h=20,x=0,y=13,fill="#e63900")|repeat(12,rotate(30))
r4 = line(x1=0,y1=6,x2=0,y2=17,stroke="green")|repeat(12,rotate(30))
show(r0,r1,r2,r3,r4)
#happy onam
e1 = circle(x=-125,y=128,r=5,stroke="#ff6600",stroke_width=3)
w1 = line(x1=-129,y1=128,x2 =-129,y2=146,stroke="#ff6600",stroke_width=3)
w2 = line(x1=-129,y1=146,x2=-110,y2=146,stroke="#ff6600",stroke_width=3)
w3 = line(x1=-110,y1=146,x2=-110,y2=128,stroke="#ff6600",stroke_width=3)
w4 = line(x1=-110,y1=128,x2=-117,y2=128,stroke="#ff6600",stroke_width=3)
w5 = line(x1=-110,y1=128,x2=-110,y2=123,stroke="#ff6600",stroke_width=3)
w6 = line(x1=-110,y1=123,x2=-117,y2=123,stroke="#ff6600",stroke_width=3)
show(e1,w1,w2,w3,w4,w5,w6)
#a
w7 = circle(x=-100,y=134,r=7,fill="#993300",stroke="none",stroke_width=50)
w8 = circle(x=-95,y=134,r=7,fill="#993300",stroke="#000066")
show(w8,w7)
#
w9 = circle(x=-75,y=130,r=5,stroke="#b30000",stroke_width=3)
w10= line(x1=-80,y1=130,x2=-80,y2=146,stroke="#b30000",stroke_width=3)
w11 = line(x1=-80,y1=146,x2=-60,y2=146,stroke="#b30000",stroke_width=3)
w12 = line(x1=-60,y1=146,x2=-60,y2=130,stroke="#b30000",stroke_width=3)
w13 = line(x1=-60,y1=146,x2=-40,y2=146,stroke="#b30000",stroke_width=3)
w14 = line(x1=-40,y1=146,x2=-40,y2=130,stroke="#b30000",stroke_width=3)
w15= line(x1=-40,y1=146,x2=-20,y2=146,stroke="#b30000",stroke_width=3)
w16= line(x1=-20,y1=146,x2=-20,y2=130,stroke="#b30000",stroke_width=3)
show(w9,w10,w11,w12,w13,w14,w15,w16)
#
w17 = circle(x=-10,y=141,r=7,fill="#993300",stroke="none")
w18 = circle(x=-5,y=141,r=7,fill="#993300",stroke="#000066",stroke_width=1)
show(w18,w17)
#
w19 = line(x1=6,y1=149,x2=6,y2=134,stroke="#800055",stroke_width=3)
w20 = line(x1=6,y1=134,x2=12,y2=134,stroke="#800055",stroke_width=3)
w21 = line(x1=12,y1=134,x2=12,y2=149,stroke="#800055",stroke_width=3)
w22 = line(x1=12,y1=149,x2=24,y2=149,stroke="#800055",stroke_width=3)
w23 =  line(x1=24,y1=149,x2=24,y2=134,stroke="#800055",stroke_width=3)
w24= line(x1=24,y1=134,x2=19,y2=134,stroke="#800055",stroke_width=3)
w25 = line(x1=19,y1=134,x2=19,y2=140,stroke="#800055",stroke_width=3)
w26 = line(x1=19,y1=140,x2=24,y2=140,stroke="#800055",stroke_width=3)
show(w19,w20,w21,w22,w23,w24,w25,w26)
#
w275 = circle(x=35,y=136,r=3,fill="white")
w276 = ellipse(w=3,h=17,fill="green")| repeat(6,rotate(30))| translate(x=35,y=136)
show(w276,w275)
#
w28 = line(x1=45,y1=128,x2=45,y2=145,stroke="#000066",stroke_width=3)
w29 = line(x1=45,y1=145,x2=53,y2=145,stroke="#000066",stroke_width=3)
w30 = line(x1=53,y1=145,x2=53,y2=128,stroke="#000066",stroke_width=3)
w31 = line(x1=53,y1=145,x2=60,y2=145,stroke="#000066",stroke_width=3)
w32 = line(x1=60,y1=145,x2=60,y2=128,stroke="#000066",stroke_width=3)
w33 = line(x1=60,y1=128,x2=66,y2=128,stroke="#000066",stroke_width=3)
w34 = line(x1=66,y1=128,x2=66,y2=145,stroke="#000066",stroke_width=3)
show(w28,w29,w30,w31,w32,w33,w34)
#
w36=line(x1=80,y1=128,x2=80,y2=147,stroke="#990099",stroke_width=3)
w37 = line(x1=80,y1=147,x2=100,y2=147,stroke="#990099",stroke_width=3)
w38 = line(x1=100,y1=147,x2=100,y2=124,stroke="#990099",stroke_width=3)
w39 = line(x1=100,y1=124,x2=74,y2=124,stroke="#990099",stroke_width=3)
w40 = line(x1=74,y1=124,x2=74,y2=134,stroke="#990099",stroke_width=3)
w41 = line(x1=90,y1=124,x2=90,y2=130,stroke="#990099",stroke_width=3)
w42= line(x1=74,y1=134,x2=105,y2=134,stroke="#990099",stroke_width=3)
w43 = line(x1=105,y1=134,x2=105,y2=124,stroke="#990099",stroke_width=3)
show(w36,w37,w38,w39,w40,w41,w42,w43)
#
w44 = line(x1=110,y1=124,x2=110,y2=144,stroke="#cc9900",stroke_width=3)
w45 = line(x1=110,y1=124,x2=120,y2=124,stroke="#cc9900",stroke_width=3)
w46 = line(x1=120,y1=124,x2=120,y2=144,stroke="#cc9900",stroke_width=3)
w47 = line(x1=120,y1=144,x2=140,y2=144,stroke="#cc9900",stroke_width=3)
w48 =line(x1=140,y1=144,x2=140,y2=124,stroke="#cc9900",stroke_width=3)
w49 =line(x1=140,y1=124,x2=132,y2=124,stroke="#cc9900",stroke_width=3)
w50 = line(x1=132,y1=124,x2=132,y2=150,stroke="#cc9900",stroke_width=3)
show(w44,w45,w46,w47,w48,w49,w50)