Python Forum
Can someone explain what ".after" means?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can someone explain what ".after" means?
#1
So, I'm writing a tkinter GUI, and it's all going pretty well. I'm new to python, and most of my coding knowledge comes from Excel VBA.

So, I've got a label on my GUI that shows the current time. It was some code I found on the internet, that I was able to apply to my application, but was wondering what exactly the ".after" syntax means and is doing. Can someone explain it in simple English for a newb? Thanks.

    def clock_set(self):
        new_time = datetime.datetime.now()        
        new_time = new_time.strftime('%m/%d/%Y       %H:%M:%S')
        if new_time != self.time_now:
            self.time_now = new_time
            self.curr_time["text"] = self.time_now
#THIS LINE
        self.curr_time.after(200, self.clock_set)
Reply
#2
it means to execute clock_set after 200 ms
Reply
#3
Thank you.
Reply


Forum Jump:

User Panel Messages

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