#175 Turtle graphics in python
import turtle
from random import randint
def get_input_angle():
angle = 199
return angle
def generate_random_colour():
# Generates an R,G,B values randomly in range 0 to 255
r = randint(0, 255)
g = randint(0, 255)
b = randint(0, 255)
return r, g, b
print('Set up Screen')
turtle.title('Colourful pattern')
turtle.setup(640, 600)
turtle.hideturtle()
turtle.bgcolor('white')
# Set the background colour of the screen
# Indicates RGB numbers will be in the range 0 to 255
turtle.colormode(255)
turtle.speed(0)
angle = get_input_angle()
print('Start the drawing')
for i in range(0, 600):
turtle.color(generate_random_colour())
turtle.forward(i)
turtle.right(angle)
print('Done')
turtle.done()
Last Updated on 2021-10-05 by gantovnik

Recent Comments