Advertisement
here2share

# t_offset_rotate.py

Feb 12th, 2021
925
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. # t_offset_rotate.py
  2.  
  3. from turtle import Turtle, Screen
  4. from itertools import cycle
  5.  
  6. ANGLE = 8
  7.  
  8. colors = ["orange", "yellow", "green", "blue"]
  9.  
  10. def offset_rotate(turtle, radius, color_names):
  11.     colors = cycle(color_names)
  12.  
  13.     for _ in range(360 // ANGLE):
  14.         turtle.color(next(colors))
  15.         turtle.circle(radius)
  16.         turtle.left(ANGLE)
  17.  
  18. tu = Turtle(visible=False)
  19. tu.speed("fastest")
  20.  
  21. offset_rotate(tu, 120, colors)
  22.  
  23. screen = Screen()
  24. screen.exitonclick()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement