Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_seq_shuffle_7.py
- from tkinter import *
- from PIL import Image, ImageTk
- from itertools import combinations
- 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))
- colors = []
- for black in range(0,100):
- for white in range(4,50):
- t = [(0,)*3]*black+[(255,)*3]*white
- colors += [t]
- colors *= 1200
- i = 1
- rgb = [(0,0,0)]*(ww*hh)
- while 1:
- ttt = []
- while len(ttt) < ww+100:
- i += 1
- t = colors.pop(i%(ww))
- colors += [t]
- ttt.extend(t)
- rgb.extend(ttt[100:ww+100])
- rgb = rgb[-ww*hh:]
- draw()
- t = colors.pop(i%(ww))
- colors += [t]
- t = colors.pop(i%(ww))
- colors += [t]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement