from turtle import Turtle, Screen
import turtle
import random

tim = Turtle()
tim.shape("triangle")
turtle.colormode(255)

def random_color():
    r = random.randint(0, 255)
    g = random.randint(0, 255)
    b = random.randint(0, 255)
    color = (r, g, b)
    return color

direction = [0, 90, 180, 270]
tim.speed("fastest")


def draw_spirograph(size_of_gap):

    for _ in range(int(360 / size_of_gap)):
        tim.color(random_color())
        tim.circle(100)
        tim.setheading((tim.heading() + size_of_gap))

draw_spirograph(10)

screen = Screen()
screen.exitonclick()