Python Forum
Can someone explain what ".after" means? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: Can someone explain what ".after" means? (/thread-22589.html)



Can someone explain what ".after" means? - p_hobbs - Nov-19-2019

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)



RE: Can someone explain what ".after" means? - Larz60+ - Nov-19-2019

it means to execute clock_set after 200 ms


RE: Can someone explain what ".after" means? - p_hobbs - Nov-25-2019

Thank you.