Page 358 -
P. 358
graphical interface elements
Now that you know about window manager properties and how
to capture them, write the code for the shutdown() function:
Here's the code so far.
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_start():
track.play(loops = -1)
def track_stop():
track.stop()
Put the
“shutdown”
function here.
track = mixer.Sound(sound_file)
start_button = Button(app, command = track_start, text = "Start")
start_button.pack(side = LEFT)
stop_button = Button(app, command = track_stop, text = "Stop")
stop_button.pack(side = RIGHT)
What needs
to go here?
app.mainloop()
you are here 4 323