Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_speed_of_graphics_ZERO_2.py
- from Tkinter import *
- from PIL import Image, ImageTk
- import random
- from time import clock
- import ast
- root = Tk()
- root.title("Zero Animation 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
- #
- xy = []
- for y in range(he):
- data_process(y)
- #xy = str(xy)
- img = Image.new( 'RGB', (wi,he))
- c = 40 # Should be at least 40 frames per second for a 2560x1440 screen
- start = clock()
- img.putdata(xy)
- imgTk = ImageTk.PhotoImage(img)
- w.create_image(0, 0, anchor=NW, image=imgTk)
- root.update()
- while c:
- # zero animation tail end measure
- c = c - 1
- #
- t = int((clock()-start)*((2560*1440)/((wi*he)*1.0)))
- if t:
- print("Needs To Be At Least %dx Faster"%t)
- else:
- print("Congratulation... Minimal Speed Exceeded!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement