Advertisement
here2share

# Tk_non-parallel_pixels.py

Aug 17th, 2015
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. # Tk_non-parallel_pixels.py
  2.  
  3. from Tkinter import *
  4. from PIL import Image, ImageTk
  5. import random
  6.  
  7. root = Tk()
  8. root.title("Non-Parallel_Pixels")
  9. root.geometry("120x120")
  10. wi = 120
  11. he = 120
  12. w = Canvas(root, width=wi, height=he)
  13. w.pack()
  14.  
  15. def data_process(y):
  16.     xy.extend([(0,random.randrange(y*2+15, 255),0) for x in range(wi)]) # set the color accordingly
  17. #
  18. img = Image.new( 'RGB', (wi,he))
  19. while 1:
  20.     xy = []
  21.     for y in range(he):
  22.         data_process(y)
  23.     img.putdata(xy)
  24.     imgTk = ImageTk.PhotoImage(img)
  25.     #time.sleep(0.02)
  26.     w.create_image(0, 0, anchor=NW, image=imgTk)
  27.     root.update()
  28. #
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement