Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_seq_shuffle_8.py
- from tkinter import *
- from PIL import Image, ImageTk
- from itertools import combinations
- import math
- ww = 600
- hh = 600
- def draw():
- image.putdata(rgb)
- photo = ImageTk.PhotoImage(image)
- canvas.create_image(0,0,image=photo,anchor=NW)
- canvas.update()
- root = Tk()
- root.title("Tk_seq_shuffle")
- root.geometry("%dx%d+0+0"%(ww,hh))
- canvas = Canvas(root, width=ww, height=hh)
- canvas.pack()
- image = Image.new("RGB", (ww,hh), (255,255,255))
- wave = []
- for z in range(10):
- wave.append([z]*(10*(12-z)))
- wave = sum(wave[1:-1]+wave[::-1], [])[::-1]
- Lwave = len(wave)
- black = [(0,)*3]
- white = [(255,)*3]
- colors = []
- for i in range(255):
- colors += [(i,i,i)]
- colors = colors[1:-1]+colors[::-1]
- Lc = len(colors)
- iii = 1
- rgb = [(255,255,255)]*(ww*hh)
- while 1:
- ttt = []
- i = iii
- while len(ttt) < ww:
- i += 1
- t = wave[i%Lwave]
- t = colors.pop(t%Lc)
- ttt.append(t)
- colors.append(t)
- rgb.extend(ttt[:ww])
- rgb = rgb[-ww*hh:]
- draw()
- iii += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement