Creating the Player class

Now, let's write the code for the Player class. This class will be responsible for the handling of audio playback and its related functions, such as pause, stop, seek, fast forward, rewind, change of volume, mute, and so on.

We will use the pyglet library to handle these functions. Pyglet is a cross-platform library that uses the AVbin module to support a large variety of audio files.

You might want to look at the API documentation of the pyglet player, which is available at

You can also access the documentation for the pyglet media player class by typing the following two lines in the Python interactive shell:

>>> import pyglet
>>> help(

The online documentation ...

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.