Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- from tkinter import colorchooser
- from random import *
- root = Tk()
- c = Canvas(root, width = 500, height = 500, bg = '#5fea57')
- c.pack()
- print (colorchooser.askcolor())
- color = ['red', 'yellow', 'blue', 'cyan', 'orange']
- def random_rectangle(width, height, col):
- x1 = randrange(width)
- y1 = randrange(height)
- x2 = x1 + randint(1, 100)
- y2 = y1 + randint(1, 100)
- c.create_rectangle(x1, y1, x2, y2, fill = col)
- for i in range(100):
- random_rectangle(500, 500, choice (color))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement