My guess is Python turtle's RGB-based colors are the wrong model for easily generating a rainbow line. Fortunately, you can import colorsys
to work with a more appropriate model, like HSV, and have it convert those values to RGB:
from turtle import Screen, Turtle
from colorsys import hsv_to_rgb
RADIUS = 300
WIDTH = 100
screen = Screen()
turtle = Turtle(visible=False)
turtle.speed('fastest') # because I have no patience
turtle.width(WIDTH)
turtle.penup()
turtle.sety(-RADIUS)
turtle.pendown()
for angle in range(360):
turtle.pencolor(hsv_to_rgb(angle / 360, 0.75, 0.75))
turtle.circle(RADIUS, 1)
screen.exitonclick()
Here we're just adjusting the hue based on the angle and leaving the saturation and value constant:
