Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_xrange_pixels.py
- from Tkinter import *
- from PIL import Image, ImageTk
- import random
- root = Tk()
- root.title("Xrange_Pixels")
- wi = 400
- he = 240
- root.geometry("%dx%d"%(wi, he))
- w = Canvas(root, width=wi, height=he)
- w.pack()
- def data_process(y):
- xy.extend([(0,random.randrange(y+15, 255),0) for x in xrange(wi)]) # set the color accordingly
- #
- img = Image.new( 'RGB', (wi,he))
- while 1:
- xy = []
- for y in xrange(he):
- data_process(y)
- img.putdata(xy)
- imgTk = ImageTk.PhotoImage(img)
- #time.sleep(0.02)
- w.create_image(0, 0, anchor=NW, image=imgTk)
- root.update()
- #
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement