Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_shade_pattern.py # Red, Green, Blue... and Yellow
- from Tkinter import *
- from PIL import Image, ImageTk
- import random
- import math
- import time
- wt = 255
- ht = 255
- root = Tk()
- root.title("Tk Shade Pattern")
- root.geometry("%dx%d+0+0"%(wt,ht))
- canvas = Canvas(root, width=wt, height=ht)
- canvas.grid()
- # create new image
- img = Image.new("RGB",(wt,ht), "white")
- if 1:
- xy = []
- for x in range(wt):
- for y in range(ht):
- t = x**2-y**2
- xy.append((x%255, y%255, t%255))
- img.putdata(xy)
- imgTk = ImageTk.PhotoImage(img)
- time.sleep(1)
- canvas.create_image(0, 0, anchor=NW, image=imgTk)
- root.update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement