Page 414 -
P. 414

custom widgets and classes


                          Pool Puzzle


                          Your job is to take segments from the
                             pool and place them into the blank
                               lines in the code. You may not use
                               the same segment more than once,
                               and you won’t need to use all the
                               segments. Your goal is to complete
                               the code in hfmix.pyw so that it
                             reads all the tracks from the directory
                          and then adds them to the GUI interface.

                                  from tkinter import *
                                  from sound_panel import *
                                  import pygame.mixer
                                  import os

                                  app = Tk()
                                  app.title("Head First Mix")

                                  mixer = pygame.mixer
                                  mixer.init()








                                  def shutdown():
                                         track.stop()
                                         app.destroy()
                                  app.protocol("WM_DELETE_WINDOW", shutdown)
           Note: each thing from   app.mainloop()
           the pool can be used
           only once!

                                          panel.pack()

                                for fname in dirList:
                                                      dirList = os.listdir(".")
                          panel = SoundPanel(app, mixer, fname)

                                  “50459_M_RED_Nephlimizer.wav”
                                                                     if fname.endswith(".wav"):





                                                                                      you are here 4    379
   409   410   411   412   413   414   415   416   417   418   419