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.04—view.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 ...