Advertisement
here2share

# Tk_speed_of_graphics_ZERO_3.py

Apr 24th, 2020
573
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.84 KB | None | 0 0
  1. # Tk_speed_of_graphics_ZERO_3.py
  2.  
  3. from Tkinter import *
  4. from PIL import Image, ImageTk
  5. import random
  6. from time import clock
  7. wi = 500
  8. he = 500
  9. '''
  10. root = Tk()
  11. root.title("No Imaging on 500x500 per Pixel")
  12. root.geometry("500x500")
  13. w = Canvas(root, width=wi, height=he)
  14. w.pack()
  15.  
  16. def data_process(y):
  17.    xy.extend([(y/2,random.randrange(255),0) for x in range(wi)]) # set the color accordingly
  18. #
  19. xy = []
  20. for y in range(he):
  21.     data_process(y)
  22. #xy = str(xy)
  23. img = Image.new( 'RGB', (wi,he))
  24.  
  25. img.putdata(xy)
  26. imgTk = ImageTk.PhotoImage(img)
  27. w.create_image(0, 0, anchor=NW, image=imgTk)
  28. root.update()
  29. '''
  30. c = 40 # Should be at least 40 frames per second for a 2560x1440 screen
  31. start = clock()
  32. while c:
  33.     # no imaging
  34.     c = c - 1
  35. #
  36. t = (clock()-start)*((2560*1440)/((wi*he)*1.0))
  37.  
  38. print("40 Frames In {:10.6f} Seconds".format(t))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement