Managing continuous updates

Next, we will update the position of the seek bar knob and the elapsed play duration, as shown in the following screenshot:

This is nothing but a simple form of Tkinter-based animation.

The most common pattern of animating with Tkinter involves drawing a single frame and then calling the same method using the after method of Tkinter, as follows:

def animate(self): self.draw_frame() self.after(500, self.animate)
Take a note of the self.after method, which calls the animate method in a loop. Once called, this function will keep updating frames once every 500 milliseconds. You can also add some conditions to break ...

Get Tkinter GUI Application Development Blueprints - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.