Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_1200x680_Each_Pixel_A_Random_Color_Test_7.py
- # xrange()
- from Tkinter import Tk, Canvas, NW
- from PIL import Image, ImageTk
- import random
- def oRGB(rgb): # pass
- r,g,b = rgb
- return "#%02x%02x%02x" % (r,g,b)
- ww = 1200
- hh = 680
- root = Tk()
- root.title("Tk_1200x680_Each_Pixel_A_Random_Color_Test_7")
- root.geometry("%dx%d+0+0"%(ww,hh))
- canvas = Canvas(root, width=ww, height=hh)
- canvas.grid()
- img = Image.new("RGB",(ww, hh))
- while 1:
- pix = []
- for x in xrange (ww):
- for y in xrange(hh):
- pix.append(tuple([random.randint(0,255) for rgb in 'zzz']))
- img.putdata(pix)
- imgTk = ImageTk.PhotoImage(img)
- canvas.create_image(0, 0, anchor=NW, image=imgTk)
- canvas.update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement