Rangoli using Python
from turtle import *
import turtle
turtle.setup(width=1.0, height=1.0)
turtle.hideturtle()
speed(100)
bgcolor("black")
r,g,b = 255, 0, 0
for i in range(255*2):
colormode(255)
if (i<255//3):
g+=3
elif(i<255*2//3):
r-=3
elif (i<255):
b+=3
elif (i<255*4//3):
g-=3
elif(i<255*5//3):
r+=3
else:
b-=3
fd(50+i)
rt(91)
pencolor(r,g,b)
def side_rangoli(col,x,y):
turtle.up()
turtle.setpos(x,y)
turtle.down()
for i in range(20):
turtle.color(col)
turtle.circle(50)
turtle.right(20)
side_rangoli("red",-570,-250)
side_rangoli("#11f57b",-570,250)
side_rangoli("blue",570,-250)
side_rangoli("yellow",570,250)
def write_txt(txt,x,y):
turtle.up()
turtle.setpos(x, y)
turtle.down()
turtle.write(txt, font=("Cooper Black",50))
write_txt("Happy", -670, 0)
write_txt("Diwali", 450, 0)
turtle.exitonclick()
Post a Comment