Advertisement
Guest User

after.py

a guest
Nov 5th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.96 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import turtle
  4. import random
  5.  
  6. #setup the display, configures background color
  7. wn = turtle.Screen()
  8. wn.bgcolor("black")
  9.  
  10. #creates all the turtles and crams them into a list
  11. artists = [turtle.Turtle() for x in range(10)]
  12.  
  13. #generates rotational angles and movements
  14. move = [random.randrange(40,60) for x in range(10)]
  15. rotate = [random.randrange(0,360) for x in range(10)]
  16.  
  17. #Configures turtle color
  18. colors = (
  19.     "Red","Blue","Purple","Brown","Gold",
  20.     "DarkKhaki","OrangeRed","DarkSlateGray",
  21.     "MediumSpringGreen","ForestGreen"
  22.     )
  23. for artist, color in zip(artists, colors):
  24.     artist.color(color)
  25.  
  26. #set up the turtles to draw the shapes
  27. for a in artists:
  28.     a.speed(0)
  29.     a.ht()
  30.     a.penup()
  31.     a.right(random.randrange(0,360))
  32.     a.forward(125)
  33.     a.pendown()
  34. for i in range(120):
  35.     for x in range(0,9):
  36.         artists[x].left(rotate[x])
  37.         artists[x].forward(move[x])
  38. wn.exitonclick()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement