- from turtle import Turtle,Screen
- import random
- timmy=Turtle()
- timmy.shape('turtle')
- colors = ["red", "green", "blue", "orange", "purple", "yellow", "pink", "cyan", "magenta", "black"]
- run=True
- screen=Screen()
- def exit(x,y):
- global run
- run=False
-
- screen.onclick(exit)
-
- directions=[0,90,180,270]
- while run:
- direction=random.choice(directions)
- timmy.setheading(direction)
- colour=random.choice(colors)
- timmy.pensize(15)
- timmy.speed('fast')
- timmy.color(colour)
- timmy.forward(30)
- screen.bye()