Click on the screen to create a spiral kaleidoscope. Wait until all 4 are drawn before you click again.

import random stage.set_background_color("black") colors = ["red", "yellow", "blue", "green", "orange", "purple", "white", "grey"] t = turtle.Turtle() t.hideturtle() t.speed(1000) def draw_kaleido(x, y): t.pencolor(random.choice(colors)) size = random.randint(10,40) draw_spiral(x, y, size) draw_spiral(-x, y, size) draw_spiral(x, -y, size) draw_spiral(-x, -y, size) def draw_spiral(x, y, size): t.penup() t.setposition(x, y) t.pendown() for m in range(size): t.forward(2*m) t.right(91) def click(): x = stage.click_x() y = stage.click_y() draw_kaleido(x, y) stage.event_click(click)
  • Run Code
  • Show Console
  • Codesters How To (opens in a new tab)