SHARE
TWEET

Untitled

a guest Feb 16th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #RandomSpiralDamianRivera.py
  2. import turtle
  3. import random
  4.  
  5. t= turtle.Pen()
  6. window = turtle.Screen()
  7. window.bgcolor("black")
  8. colors=["red", "white", "blue" , "pink", "magenta", "yellow", "orange", "green"]
  9. def spiral ():
  10.         x = random.randrange(-turtle.window_width()//2,
  11.                          turtle.window_width()//2)
  12.         y = random.randrange(-turtle.window_height()//2,
  13.                          turtle.window_height()//2)
  14.  
  15.         size = random.randint(10, 40)
  16.         t.pencolor(random.choice((colors)))
  17.         t.penup()
  18.         t.setpos(x, y)
  19.         t.pendown()
  20.         for w in range (size):          
  21.             t.forward(w*4)
  22.             t.left(91)
  23. for i in range (50):
  24.     spiral()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top