Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_Pastel_Pixels.py
- from Tkinter import *
- from PIL import Image, ImageTk
- import random
- root = Tk()
- root.title("Pastel Pixels")
- width = 200
- height = 200
- root.geometry("%dx%d"%(width, height))
- w = Canvas(root, width=width, height=height)
- w.pack()
- def rnd():
- return [random.randint(0, 255) for z in '...']
- def data_process(y):
- for x in xrange(width):
- m = random.randint(3, 12)
- try:
- xRGB = xy[((y-1)*width)+x]
- except:
- xRGB = rnd()
- try:
- yRGB = xy[(y*width)+(x-1)]
- except:
- yRGB = rnd()
- rgb = tuple([int((((xRGB[z]+yRGB[z])/25*25*m)+rnd()[0])/(m*2+1)*1.054) for z in xrange(3)])
- xy.append(rgb)
- #
- img = Image.new( 'RGB', (width,height))
- while 1:
- xy = []
- for y in xrange(height):
- data_process(y)
- # print min(xy), max(xy)
- 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