Looping over tracks

Let's add the feature that allows users to loop over tracks. We have already defined radio buttons to allow three choices, as shown in the following screenshot:

Looping over tracks

In essence, the player should provide a choice from the following three options:

  • No Loop: Play a track and end there
  • Loop Current: Play a single track repeatedly
  • Loop All: Looping through the entire playlist, one after another

The decision to follow one of these three options needs to be taken immediately after a particular track ends playing. The best place to judge whether a track has come to its end is from within the periodic updates loop that we created earlier.

Therefore, ...

Get Tkinter GUI Application Development Blueprints 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.