Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- import random
- window = Tk()
- holst = Canvas(window, width=400, height=400)
- holst.pack()
- def ranrec(width, height, fcol): **fcol it's fill color**
- x1 = random.randrange(width)
- y1 = random.randrange(height)
- x2 = random.randrange(x1 + random.randrange)
- y2 = random.randrange(y1 + random.randrange)
- holst.create_rectangle(x1, y1, x2, y2, fill=fcol)
- from tkinter import colorchoser **adding submodule**
- c = colorchooser.askcolor()
- ranrec(400, 400, c[1])
Add Comment
Please, Sign In to add comment