Skip to Content
Tkinter GUI Application Development Blueprints, Second Edition - Second Edition
book

Tkinter GUI Application Development Blueprints, Second Edition - Second Edition

by Bhaskar Chaudhary
March 2018
Beginner to intermediate
422 pages
10h 33m
English
Packt Publishing
Content preview from Tkinter GUI Application Development Blueprints, Second Edition - Second Edition

Adding the volume change function

We have already defined the volume method in the Player class. Now, all that you need to do is simply get the value of the Volume Scale widget and set the volume in the Player class.

Also, ensure that in case the volume becomes zero, we change the volume button icon to the mute image (see code 5.04view.py):

def on_volume_scale_changed(self, value):  self.player.volume = self.volume_scale.get()  if self.volume_scale.get() == 0.0:    self.mute_unmute_button.config(image=self.mute_icon)  else:    self.mute_unmute_button.config(image=self.unmute_icon)

This concludes the iteration. The player is now functional enough to be called an audio player. Go ahead and add some music files to the player. Press the play button and ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Tkinter GUI Application Development Blueprints

Tkinter GUI Application Development Blueprints

Bhaskar Chaudhary

Publisher Resources

ISBN: 9781788837460Supplemental Content