Pookkalam by Ashik M

Code

class Grid:
    def grid_bg():
        c = rectangle(h=301, w=301, fill="white")
        return c
    
    def background():
        c = circle(r=150, fill="black")
        return c

class Pookalam:
    def center():
        def repeat_innerC():
            c1 = ellipse(w=50, h=110, x=0, y=0, stroke_width=2,  fill="purple") | rotate(60) | repeat(3, rotate(60))
            c01 = circle(r=30, x=0, y=40, stroke_width=2, fill="#ff8c21") | rotate(90) | repeat(6, rotate(60))
            c =c01+c1
            return c
        def poly():
            p1 = line(x1=0,y1=0,x2=0,y2=30,stroke="orange") | rotate(35) | repeat(30, rotate(1)) | repeat(4, rotate(90))
            p2 = line(x1=0,y1=0,x2=0,y2=40,stroke="#ff0000") | rotate(35) | repeat(30, rotate(1)) | repeat(4, rotate(90))
            c = circle(r=30)
            p = p2+p1+c
            return p
        c_1 = circle(r=10, x=0, y=0, fill="white", stroke_width=2)
        c_2 = circle(r=20, x=0, y=0, fill="yellow")
        c_3 = circle(r=30, x=0, y=0, fill="#43A047")
        c_4 = circle(r=40, x=0, y=0, fill="#1B5E20")
        c_5 = repeat_innerC()
        p = poly()
        c = combine([c_5,c_4, c_3,p, c_2, c_1 ])
        return c
    def middle():
        def tri_cir():
            p1 = point(x=-26, y=114.5)
            p2 = point(x=26, y=114.5)
            p3 = point(x=0, y=145)
            tri = polygon([p1,p2,p3], fill="#cc000e",stroke_width=0) | repeat(8, rotate(45))
            cir = circle(r=30, x=0, y=100, fill="#cc000e") | repeat(8, rotate(45))
            s_cir1 = circle(r=8, x=0, y=100, fill="purple") | repeat(8, rotate(45))
            s_cir2 = circle(r=12, x=0, y=100, fill="orange") | repeat(8, rotate(45))
            c = combine([cir,tri,s_cir2,s_cir1])
            return c
        c = tri_cir()
        return c
    def last():
        r1 = rectangle(w=210,h=210,fill="#f5f584",stroke="none") | repeat(10, rotate(9))
        r2 = rectangle(w=196,h=196,fill="yellow",stroke="none") | rotate(5) |repeat(10, rotate(9))
        r3 = rectangle(w=182,h=182,fill="#488242",stroke="none")|repeat(10, rotate(9))
        r4 = rectangle(w=168,h=168,fill="#0a7500",stroke="none") | rotate(5) |repeat(10, rotate(9))
        r5 = rectangle(w=154,h=154,fill="#054716",stroke="none")|repeat(10, rotate(9))
        cLast = circle(r=105, fill="#054716")
        r = r1+r2+r3+r4+r5
        c = cLast+r
        return c

show(Grid.grid_bg(),Grid.background())
show(Pookalam.last(),Pookalam.center(),Pookalam.middle())