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 out of the animation loop. This is generally how all animations are handled in Tkinter. We will use this technique over and over again in several upcoming examples.
Now that we know how to manage animations in Tkinter, let's use the pattern...