Advertisement
Guest User

untlidet

a guest
Apr 18th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. from tkinter import *
  2. from tkinter import colorchooser
  3. from random import *
  4.  
  5. root = Tk()
  6. c = Canvas(root, width = 500, height = 500, bg = '#5fea57')
  7. c.pack()
  8.  
  9. print (colorchooser.askcolor())
  10.  
  11. color = ['red', 'yellow', 'blue', 'cyan', 'orange']
  12.  
  13. def random_rectangle(width, height, col):
  14. x1 = randrange(width)
  15. y1 = randrange(height)
  16. x2 = x1 + randint(1, 100)
  17. y2 = y1 + randint(1, 100)
  18. c.create_rectangle(x1, y1, x2, y2, fill = col)
  19.  
  20. for i in range(100):
  21. random_rectangle(500, 500, choice (color))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement