Advertisement
here2share

# Tk_250x250_Each_Pixel_A_Random_Color_Test_2.py

Mar 15th, 2021
930
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. # Tk_250x250_Each_Pixel_A_Random_Color_Test_2.py
  2.  
  3. from Tkinter import *
  4. import random
  5.  
  6. def oRGB(rgb): # pass
  7.     r,g,b = rgb
  8.     return "#%02x%02x%02x" % (r,g,b)
  9.  
  10. ww = 250
  11. hh = 250
  12. root = Tk()
  13. root.title("Tk 250x250 Each Pixel A Random Color")
  14. root.geometry("%dx%d+0+0"%(ww,hh))
  15. canvas = Canvas(root, width=ww, height=hh)
  16. canvas.grid()
  17.  
  18. while 1:
  19.     for x in range (ww):
  20.         for y in range(hh):
  21.             rgb = tuple([random.randint(0,255) for rgb in 'zzz'])
  22.             canvas.create_line((x,y,x+1,y),fill=oRGB(rgb))
  23.     canvas.update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement