Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_speed_of_graphics.py
- from Tkinter import *
- from PIL import Image, ImageTk
- import random
- root = Tk()
- root.title("Speed of Graphics on 500x500 per Pixel")
- root.geometry("500x500")
- wi = 500
- he = 500
- w = Canvas(root, width=wi, height=he)
- w.pack()
- def data_process(y):
- xy.extend([(y/2,random.randrange(255),0) for x in range(wi)]) # set the color accordingly
- #
- img = Image.new( 'RGB', (wi,he))
- while 1:
- xy = []
- for y in range(he):
- data_process(y)
- img.putdata(xy)
- imgTk = ImageTk.PhotoImage(img)
- w.create_image(0, 0, anchor=NW, image=imgTk)
- root.update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement