Back to blog
Python

Draw Rainbow Art with Python Turtle

Turn a few lines of code into spinning rainbow spirals using Python's built-in drawing robot.

Mia 12 September 2026 5 min read
Draw Rainbow Art with Python Turtle

Turtle is a tiny robot that lives inside Python. You tell it to move forward and turn, and it leaves a trail of colour behind it.

Wake up the turtle

python
 1import turtle
 2
 3pen = turtle.Turtle()
 4pen.speed(0)
 5pen.pensize(3)

Spin a rainbow spiral

Each time around the loop the turtle picks the next colour, walks a bit further and turns just past a right angle. That small extra turn is what makes the spiral swirl.

python
 1colors = ["red", "orange", "gold", "green", "blue", "purple"]
 2
 3for step in range(120):
 4    pen.color(colors[step % len(colors)])
 5    pen.forward(step * 2)
 6    pen.right(91)
 7
 8turtle.done()

Tiny changes, huge difference

  • Change right(91) to right(121) for a triangle flower.
  • Swap the colour list for your favourite team colours.
  • Use pen.circle(step) instead of forward for bubble art.

Try it yourself

Make an art generator that looks different every time you run it.

  1. 1Import the random module at the top of your file.
  2. 2Pick the turn angle with random.randint(80, 130).
  3. 3Print the angle you used so you can save your favourites.
  4. 4Screenshot your best spiral and show it to a friend.
Back to blog

Keep going