MrThoe

Cool turtle

Aug 28th, 2019
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. """
  2. This is an example of the package: turtle
  3. """
  4.  
  5. import turtle
  6.  
  7. allen = turtle.Turtle()
  8.  
  9. wn = turtle.Screen()
  10. wn.title("Allen")
  11. wn.colormode(255)
  12. wn.bgcolor(0,0,0)
  13.  
  14. allen.speed(0)
  15. allen.color()
  16.  
  17. #Polygon with 2 parameters (num sides, side lengh)
  18. def poly(numSides, sideLength):
  19. for i in range(numSides):
  20. allen.forward(sideLength)
  21. allen.right(360/numSides)
  22. a = 30
  23. b = 3
  24. counter = 0 #accumulator
  25. red = 255
  26. green = 255
  27. blue = 255
  28.  
  29. #Standard FOR loop
  30. for i in range(1000):
  31. poly(b, a)
  32. b += 1
  33. allen.right(40)
  34. allen.color(red,green,blue)
  35. if (counter%2 == 0):
  36. blue -= 10
  37. red -= 10
  38. counter += 1
Advertisement
Add Comment
Please, Sign In to add comment