Advertisement
Guest User

Untitled

a guest
Feb 24th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. import tkinter as tk
  2. from PIL import Image, ImageTk
  3. from Tkinter import *
  4. import Image, ImageTk
  5. import glob,os
  6.  
  7.  
  8. def RecentFilePath():
  9. folder = "C:\\NIR"
  10. return(str(max((x for x in glob.glob(os.path.join(folder,"*")) if os.path.isfile(x)),key=os.path.getmtime)))
  11.  
  12. root = tk.Tk()
  13.  
  14. img = ImageTk.PhotoImage(Image.open('test.png'))
  15. panel = tk.Label(root, image = img)
  16. panel.pack(side = "bottom", fill = "both", expand = "yes")
  17. t = True
  18. def callback():
  19. global t
  20. t = not t
  21. if(t):
  22. img2 = ImageTk.PhotoImage(Image.open('yubi.PNG'))
  23. else:
  24. img2 = ImageTk.PhotoImage(Image.open('test.PNG'))
  25. panel.configure(image = img2)
  26. panel.image = img2
  27. root.after(1000, callback)
  28.  
  29. root.after(1000, callback)
  30. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement