Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import * #Import every function from random and tkinter.
- from tkinter import *
- size = 500 #Set the size of the canvas to 500 pixels (px).
- window = Tk() #Make a window.
- canvas = Canvas(window, width=size, height=size) #Width & height = var size.
- canvas.pack() # Add the canvas to the window.
- while True: #Forever loop
- col = choice(["pink", "orange", "purple", "yellow"])
- #choose a random color in the list.
- #Create a circle with a random size and location.
- x0 = randint(0, size)
- y0 = randint(0, size)
- d = randint(0, size/5)
- canvas.create_oval(x0, y0, x0 + d, y0 + d, fill=col) #Draws the circle.
- window.update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement