Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_rgb_sequences_2.py
- from tkinter import *
- from PIL import Image, ImageTk
- import math
- from itertools import combinations
- ww = 500
- hh = 500
- sz = 10
- root = Tk()
- root.geometry("%dx%d+0+0"%(ww,hh))
- canvas = Canvas(root, width=ww, height=hh)
- canvas.pack()
- t = range(0,256,5)
- TTT = []
- for r in t:
- for g in t:
- for b in t:
- TTT += [(r, g, b)]
- # TTT.sort(key=sum)
- TTT = TTT[1:-1]+TTT[::-1]
- def make_rgb():
- return '#%02X%02X%02X'%(r,g,b)
- i = 0
- seq = 1 # sequences
- sub = 1
- while 1:
- ttt = TTT[:]
- seq += 1
- sub = seq
- print (seq)
- canvas.delete('all')
- for y in range(0,hh,sz):
- L = len(ttt)
- for x in range(0,ww+1,sz):
- r,g,b = ttt.pop(sub%L)
- L = L - 1
- sub = sub + int(L/100) + seq
- canvas.create_rectangle((x, y, x-sz, y+sz), fill=make_rgb(), width=0)
- canvas.update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement