This code creates infinite circles of different colors(according to the colors given), and different shapes in various positions in the window. You can change the background color and the color of the circles to get more designs.
import random
from turtle import *
setup()
tl = Turtle()
tl.up()
bgcolor("black")
colors = ["red" , "magenta" , "purple" , "green" , "greenyellow" , "blue"]
tl.speed(0)
while True:
x = random.randint(-300 , 300)
y = random.randint(-300 , 300)
circle_size = random.randint(1 , 300)
circle_color = random.choice(colors)
tl.goto(x,y)
tl.down()
tl.color(circle_color)
tl.circle(circle_size)
tl.up()
Comments
Post a Comment