Guest User

Untitled

a guest
Oct 21st, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. from tkinter import *
  2. import random
  3. window = Tk()
  4. holst = Canvas(window, width=400, height=400)
  5. holst.pack()
  6. def ranrec(width, height, fcol): **fcol it's fill color**
  7. x1 = random.randrange(width)
  8. y1 = random.randrange(height)
  9. x2 = random.randrange(x1 + random.randrange)
  10. y2 = random.randrange(y1 + random.randrange)
  11. holst.create_rectangle(x1, y1, x2, y2, fill=fcol)
  12. from tkinter import colorchoser **adding submodule**
  13. c = colorchooser.askcolor()
  14. ranrec(400, 400, c[1])
Add Comment
Please, Sign In to add comment