Allena_Gorskaya

Programma 3

Mar 13th, 2019
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. from tkinter import *
  2. from random import *
  3.  
  4. root = Tk()
  5.  
  6. color = []
  7. for x in range(10):
  8.     color.append(randint(0, 2))
  9.  
  10. for x in range(10):
  11.     if color[x] == 0:
  12.         square = Label(text = '', bg = 'red', width = 2)
  13.     elif color[x] == 1:
  14.         square = Label(text = '', bg = 'blue', width = 2)
  15.     else:
  16.         square = Label(text = '', bg = 'green', width = 2)
  17.     square.grid(row = 0, column = x)
  18.  
  19. root.mainloop()
Add Comment
Please, Sign In to add comment