Advertisement
farrismp

Untitled

Apr 24th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. from turtle import Turtle
  2. import random
  3. import time
  4.  
  5. tina = Turtle()
  6.  
  7. # function to draw circle
  8. def draw_circle(using,r,colr,x,y):
  9. using.penup()
  10. using.goto(x, y)
  11. using.pendown()
  12. using.dot(r * 2, colr)
  13.  
  14. # Lets draw 5 circles on screensize
  15. for x in range(5):
  16. # co-ordinates
  17. a = random.randrange(-300,300, step=10)
  18. b = random.randrange(-300, 300, step = 10)
  19. # random colour
  20. clr = random.choice(["red", "blue", "green", "yellow"])
  21. # draw it
  22. draw_circle(tina,50, clr, a, b)
  23.  
  24. # take a brief pause
  25. time.sleep(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement