Advertisement
here2share

# Tk_random_circles.py

Aug 8th, 2016
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. # Tk_random_circles.py
  2.  
  3. from Tkinter import *
  4. import random
  5.  
  6. root = Tk()
  7. w = 640
  8. h = 480
  9. cv = Canvas(width=w, height=h, bg='black')
  10. cv.pack()
  11. colorList = ["blue", "red", "green", "white", "yellow", "magenta", "orange"]
  12.  
  13. while 1:
  14.     x = random.randint(-20, w)
  15.     y = random.randint(-20, h)
  16.     r = random.randint(10, 60)
  17.     color = random.choice(colorList)
  18.     cv.create_oval(x, y, x+r, y+r, fill=color)
  19.     root.update()
  20.  
  21. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement