SHARE
TWEET

untlidet

a guest Apr 18th, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top