Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_random_circles.py
- from Tkinter import *
- import random
- root = Tk()
- w = 640
- h = 480
- cv = Canvas(width=w, height=h, bg='black')
- cv.pack()
- colorList = ["blue", "red", "green", "white", "yellow", "magenta", "orange"]
- while 1:
- x = random.randint(-20, w)
- y = random.randint(-20, h)
- r = random.randint(10, 60)
- color = random.choice(colorList)
- cv.create_oval(x, y, x+r, y+r, fill=color)
- root.update()
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement