Python Forum
Refresh image in label after every 1s using simple function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Refresh image in label after every 1s using simple function
I am trying to refresh the Label Image after every 1s I have created one class in which only one time I 'll click on the button to display the image and after that, it will refresh after every second but unable to make that work

Earlier I was trying to make it work with canvas but it wasn't helping me out by showing it through label but was able to refresh using

self.canvas.after(100, self.loopCap)
but now in a label widget, I am not able to understand how refreshing the label every time

Code for is mentioned below:
class PageTwo(tk.Frame):
    def loopCap(self):
        # self.label = Label(self.master, image=self.img, textvariable=self.text)
        self.img ="img.jpg")
        self.label = ImageTk.PhotoImage(self.img)
        tk.Label(self, image=self.label).pack()

    def __init__(self, master):
        tk.Frame.__init__(self, master,bg='powder blue')
        self.master.config(bg='powder blue')
        tk.Button(self, text="Return to start page",
Suggestions will be much appreciated
you can use the tkinter after method

Possibly Related Threads…
Thread Author Replies Views Last Post
  tkinter: Image to Label Maryan 10 667 Oct-29-2020, 01:48 PM
Last Post: joe_momma
  [Tkinter] Returning always the last image into Label Lucas_Ribeiro 1 662 May-08-2020, 05:56 PM
Last Post: deanhystad
  Unable to update or refresh label text in tkinter jenkins43 3 3,048 Jul-24-2019, 02:09 PM
Last Post: Friend
  Simple Button click on image file to create action? jpezz 4 2,044 Mar-27-2019, 10:08 PM
Last Post: jpezz
  Tkinter refresh eduardoforo 4 6,507 Nov-14-2018, 09:35 PM
Last Post: woooee
  [Tkinter] Label doesn't refresh jollydragon 7 3,620 Jul-13-2018, 05:55 AM
Last Post: jollydragon
  [PyQt] enviremont refresh duende 2 1,807 May-13-2018, 09:49 AM
Last Post: duende
  pyqt main window refresh poblems duende 0 2,867 Apr-13-2018, 05:05 PM
Last Post: duende
  Refresh test in urwid.Text Stensborg 1 2,443 Mar-05-2018, 11:23 AM
Last Post: Stensborg
  [Tkinter] problem with refresh UI in tkinter app Philbot 5 6,381 Feb-06-2018, 01:10 PM
Last Post: Philbot

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020