Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_rgb_gradient.py ZZZ left-click-scroll
- from Tkinter import *
- from PIL import Image, ImageTk
- import random
- import math
- import time
- wt = 1400
- ht = 690
- root = Tk()
- root.title("Tk RGB")
- root.geometry("%dx%d+0+0"%(wt,ht))
- canvas = Canvas(root, width=wt, height=ht)
- canvas.grid()
- img = Image.new("RGB",(wt,ht), "white")
- cc = {}
- for x in range(wt):
- for y in range(ht):
- cc[x,y] = 0
- xy = []
- x2 = 256.0/wt
- y2 = 256.0/ht
- for y in range(ht):
- b = int(y*y2)
- for x in range(wt):
- a = int(x*x2)
- c = cc[a,b]
- xy += [(a,b,c)]
- cc[a,b] = c+1
- 0
- if 1:
- img.putdata(xy)
- imgTk = ImageTk.PhotoImage(img)
- canvas.create_image(0, 0, anchor=NW, image=imgTk)
- root.update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement