Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- from PIL import Image, ImageTk
- from Tkinter import *
- import Image, ImageTk
- import glob,os
- def RecentFilePath():
- folder = "C:\\NIR"
- return(str(max((x for x in glob.glob(os.path.join(folder,"*")) if os.path.isfile(x)),key=os.path.getmtime)))
- root = tk.Tk()
- img = ImageTk.PhotoImage(Image.open('test.png'))
- panel = tk.Label(root, image = img)
- panel.pack(side = "bottom", fill = "both", expand = "yes")
- t = True
- def callback():
- global t
- t = not t
- if(t):
- img2 = ImageTk.PhotoImage(Image.open('yubi.PNG'))
- else:
- img2 = ImageTk.PhotoImage(Image.open('test.PNG'))
- panel.configure(image = img2)
- panel.image = img2
- root.after(1000, callback)
- root.after(1000, callback)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement