Hi,
I've been searching for this on google for a while, but I didn't find anything.
I want to display an Image inside a Tkinter Window, but the Window should refresh the image every second or so.
How do I do that?
My Code so far:
I've been searching for this on google for a while, but I didn't find anything.
I want to display an Image inside a Tkinter Window, but the Window should refresh the image every second or so.
How do I do that?
My Code so far:
Code:
import Tkinter import Image, ImageTk im = Image.open('temp.png') root = Tkinter.Tk() tkimage = ImageTk.PhotoImage(im) Tkinter.Label(root, image=tkimage).pack() def update_image(): im = None tkimage = None Tkinter.Label.destroy() im = Image.open('temp.png') tkimage = ImageTk.PhotoImage(im) Tkinter.Label(root, image=tkimage).pack() root.geometry('%dx%d' % (im.size[0],im.size[1])) root.after(1000, update_image) root.after(1000, update_image) root.mainloop()
Comment