Advertisement
Guest User

Untitled

a guest
Mar 27th, 2015
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. from tkinter import *
  2. from PIL import Image, ImageTk
  3. import time
  4.  
  5. t = Tk()
  6. t.resizable(False, False)
  7. t.attributes('-fullscreen', True)
  8.  
  9. width = t.winfo_screenwidth()
  10. height = t.winfo_screenheight()
  11. padding = 50
  12.  
  13. c = Canvas(t, bd=-2, width=width, height=height, bg="#434343")
  14. c.pack()
  15.  
  16. global currentImage
  17. currentImage = ImageTk.PhotoImage(Image.open("image.jpg"))
  18.  
  19. def render():
  20. global currentImage
  21. c.delete("all")
  22. c.create_image(width / 2, height / 2, image=currentImage)
  23. c.update()
  24.  
  25. def stop(event):
  26. running = False
  27. t.destroy()
  28.  
  29. t.bind("<Escape>", stop)
  30.  
  31. running = True
  32.  
  33. try:
  34. while running:
  35. global currentImage
  36. currentImage = ImageTk.PhotoImage(Image.open("image.jpg"))
  37. render()
  38. time.sleep(0.1)
  39. t.update()
  40. except:
  41. Exception
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement