Page 377 -
P. 377
control the volume
Take the pygame and tkinter code and combine it to support a volume control. Then, complete
the next version of your program.
from tkinter import *
import pygame.mixer
app = Tk()
app.title("Head First Mix")
app.geometry('250x100+200+100')
sound_file = "50459_M_RED_Nephlimizer.wav"
mixer = pygame.mixer
mixer.init()
def track_toggle():
if track_playing.get() == 1:
track.play(loops = -1)
else:
track.stop()
Add a function here
to adjust the volume
that the track
currently plays at.
342 Chapter 9