Playing audio and adding audio controls
In this iteration, we will code the features marked in the following screenshot:
This includes the play/stop, pause/unpause, next track, previous track, fast forward, rewind, volume change, and mute/unmute features.
Adding the play/stop function
Now that we have a playlist and a Player
class that can play audio, playing audio is simply about updating the current track index and calling the play
method.
Accordingly, let's add an attribute, as follows (see code 5.04
– view.py
):
current_track_index = 0
Furthermore, the Play button should act as a toggle between the play
and stop
functions. The Python itertools
module ...
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.