O'Reilly logo

Tkinter GUI Application Development Blueprints - Second Edition by Bhaskar Chaudhary

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 https://bitbucket.org/pyglet/pyglet/wiki/Home.

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(pyglet.media) 

The online documentation ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required