Python Forum

Full Version: Can someone explain what ".after" means?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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)
it means to execute clock_set after 200 ms
Thank you.