Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # every_color.py
- import math
- 0
- def common(z):
- r,g,b,a = z
- g += 256
- b += 256*2
- return (r+g+b)/80, z
- 0
- from Tkinter import *
- import tkFileDialog
- from cStringIO import StringIO
- from PIL import ImageTk, ImageDraw, ImageChops, Image
- import base64, zlib
- import re
- w = 200
- h = 200
- root = Tk()
- root.geometry("%dx%d+-10+0"%(w,h))
- canvas = Canvas(root, width=w, height=h)
- canvas.grid()
- size = w*(h/2)
- x = range(128,256)
- rgb = []
- for r in x:
- if not r%32: print 256 - r
- for g in x:
- for b in x:
- rgb += [(r+g+b,(r,g,b))]
- print 0
- print 'Now Sorting...'
- rgb.sort()
- print 'Sorted...'
- while 1:
- for z in rgb:
- rgb_img = [z[1]]*size
- img = Image.new('RGB', (w,h/2))
- r,g,b = [x-128 for x in z[1]]
- img.putdata(tuple(rgb_img))
- photo = ImageTk.PhotoImage(img)
- canvas.create_image(0,h/4, image=photo, anchor='w')
- canvas.create_text(100,20, text=z[1])
- rgb2 = tuple([x-128 for x in z[1]])
- rgb_img2 = [rgb2]*size
- img2 = Image.new('RGB', (w,h/2))
- img2.putdata(tuple(rgb_img2))
- photo2 = ImageTk.PhotoImage(img2)
- canvas.create_image(0,h-h/4, image=photo2, anchor='w')
- canvas.create_text(100,120, fill='white', text=(rgb2))
- root.update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement