Advertisement
here2share

# Tk_seq_shuffle_7.py

Apr 16th, 2022
1,131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.89 KB | None | 0 0
  1. # Tk_seq_shuffle_7.py
  2.  
  3. from tkinter import *
  4. from PIL import Image, ImageTk
  5. from itertools import combinations
  6.  
  7. ww = 600
  8. hh = 600
  9.  
  10. def draw():
  11.     image.putdata(rgb)
  12.     photo = ImageTk.PhotoImage(image)
  13.     canvas.create_image(0,0,image=photo,anchor=NW)
  14.     canvas.update()
  15.    
  16.  
  17. root = Tk()
  18. root.title("Tk_seq_shuffle")
  19. root.geometry("%dx%d+0+0"%(ww,hh))
  20.    
  21. canvas = Canvas(root, width=ww, height=hh)
  22. canvas.pack()
  23.  
  24. image = Image.new("RGB", (ww,hh), (255,255,255))
  25.  
  26. colors = []
  27. for black in range(0,100):
  28.     for white in range(4,50):
  29.         t = [(0,)*3]*black+[(255,)*3]*white
  30.         colors += [t]
  31. colors *= 1200
  32.  
  33. i = 1
  34. rgb = [(0,0,0)]*(ww*hh)
  35.  
  36. while 1:
  37.     ttt = []
  38.     while len(ttt) < ww+100:
  39.         i += 1
  40.         t = colors.pop(i%(ww))
  41.         colors += [t]
  42.         ttt.extend(t)
  43.     rgb.extend(ttt[100:ww+100])
  44.     rgb = rgb[-ww*hh:]
  45.     draw()
  46.     t = colors.pop(i%(ww))
  47.     colors += [t]
  48.     t = colors.pop(i%(ww))
  49.     colors += [t]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement