Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_rgb_brush_putdata.py
- from tkinter import *
- from PIL import Image, ImageTk
- import random
- from itertools import permutations
- ww = 600
- hh = 600
- root = Tk()
- root.title("Tk_rgb_brush_putdata.py")
- root.geometry("%dx%d+0+0"%(ww,hh))
- def rgb2hex(r,g,b):
- return '#%02X%02X%02X'%(r,g,b)
- def draw():
- image.putdata(rgb)
- photo = ImageTk.PhotoImage(image)
- canvas.create_image(0,0,image=photo,anchor=NW)
- canvas.update()
- 0
- canvas = Canvas(root, width=ww, height=hh)
- canvas.pack()
- image = Image.new("RGB", (ww,hh), (255,255,255))
- scan = [tuple([random.randint(0,255) for z in 'rgb']) for z in range(ww)]
- while 1:
- rgb = []
- for y in range(hh):
- ttt = []
- for data in scan:
- t = tuple([(i+random.choice((-15,0,15)))%255 for i in data])
- ttt.append(t)
- rgb.append(t)
- scan = ttt[:]
- draw()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement