Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_250x250_Each_Pixel_A_Random_Color_Test_3.py
- from Tkinter import *
- import random
- def oRGB(rgb): # pass
- r,g,b = rgb
- return "#%02x%02x%02x" % (r,g,b)
- ww = 250
- hh = 250
- root = Tk()
- root.title("Tk 250x250 Each Pixel A Random Color")
- root.geometry("%dx%d+0+0"%(ww,hh))
- canvas = Canvas(root, width=ww, height=hh)
- canvas.grid()
- pix = PhotoImage(width=ww, height=hh)
- while 1:
- for x in range (ww):
- for y in range(hh):
- rgb = oRGB([random.randint(0,255) for rgb in 'zzz'])
- pix.put(rgb, (x, y))
- canvas.create_image(0, 0, image=pix, anchor='nw')
- canvas.update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement