I have this code, using turtle graphics in Python:
import turtle
import time as wait
turtle.setup(500,500)
ws = turtle.Screen()
ws.title('epic turtl')
ws.bgcolor('black')
turtle.tilt(73)
turtle.color('red','yellow')
turtle.turtlesize(5,5,7)
turtle.shape('circle')
turtle.penup()
i = 1
color_r = 1.0
color_b = 1.0
color_g = 1.0
while i <= 360:
turtle.forward(1)
turtle.left(1)
i += 1
color_r += 1.0
color_b += 1.0
color_g += 1.0
turtle.bgcolor(color_r, color_g, color_b)
wait.sleep(10)
I'm trying to change the color_r
, color_g
and color_b
values by 1 each time. However, I get an error: bad color sequence: (2.0, 2.0, 2.0)
Why does this occur, and how do I fix it?