Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_Gradient_Art_1400x700.py
- from Tkinter import *
- from PIL import Image, ImageTk
- import string
- import time
- import random
- import math
- from itertools import product
- ri_ = random.randint
- rs_ = random.shuffle
- rc_ = random.choice
- tx_ = time.time
- ww = 1400
- hh = 700
- root = Tk()
- root.title("Tk_Gradient_Art_1400x700")
- root.geometry("%dx%d+-10+0"%(ww,hh))
- alpha = string.letters
- xy = [[] for z in range(ww*hh)]
- abc = []
- for x in alpha:
- for y in alpha+'0123456789':
- for z in alpha+'0123456789':
- t = x+y+z
- if not t.isalpha():
- exec(t+'=(255,255,0)')
- abc.append(t)
- L = len(abc)
- print L
- v = []
- for y in range(hh):
- for x in range(ww):
- t = y*ww+x
- a = y
- b = x+ww
- c = y+ww*2-x
- d = y+ww*3+x
- for z in [a,b,c,d]:
- v.append(abc[z])
- xy[t].append(abc[z])
- 0
- print '...'
- vvv = []
- for z in list(set(v)):
- vvv.append((v.index(z),z))
- vvv.sort()
- matrix = '['+','.join(['Q[{}+{}+{}+{}]'.format(*z) for z in xy])+']'
- p = 1079281
- ppp = p*2
- t = len(matrix)
- # hack for the color list... but slows quite a bit
- exec("def o(): return "+str(matrix[:t/2])+"]+eval('['+str(matrix[t/2+1:]))")
- rainbow=[]
- def z(r,g,b):
- rainbow.append((r,g,b))
- r,g,b=255,0,0
- for g in range(256):
- z(r,g,b)
- for r in range(254, -1, -1):
- z(r,g,b)
- for b in range(256):
- z(r,g,b)
- for g in range(254, -1, -1):
- z(r,g,b)
- for r in range(256):
- z(r,g,b)
- for b in range(254, -1, -1):
- z(r,g,b)
- Q = rainbow[1:-1]+rainbow[::-1]
- LQ = len(Q)
- vars = []
- for k,v in enumerate(vvv):
- exec(v[1]+'='+str(Q[k%LQ]))
- vars += [v[1]]
- def draw():
- image.putdata(rgb)
- photo = ImageTk.PhotoImage(image)
- canvas.create_image(0,0,image=photo,anchor='nw')
- canvas.update()
- 0
- canvas = Canvas(root, width=ww, height=hh)
- canvas.pack()
- image = Image.new("RGB", (ww,hh), (255,255,225))
- ccc = LQ/4
- iii = (255**3)/4
- wave = []
- for z in range(200):
- for i in range(201-z):
- wave.append((z-100)*0.005)
- Lw = len(wave)
- rnd = 3
- while 1:
- for _ in xrange(9999999):
- for z in vars:
- rnd = rc_(wave)
- iii = (iii+rnd)%ccc
- exec(z+'='+str(int(iii)))
- rgb = o()
- draw()
Add Comment
Please, Sign In to add comment