O'Reilly logo

Tkinter GUI Application Development Blueprints - Second Edition by Bhaskar Chaudhary

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding a single audio file

Adding a file involves asking for the location using Tkinter filedialog and updating the frontend and backend, as follows (see code 5.03view.py):

def add_audio_file(self): audio_file = tkinter.filedialog.askopenfilename(filetypes=[(       'All supported', '.mp3 .wav'), ('.mp3 files', '.mp3'),('.wav files', '.wav')]) if audio_file:   self.model.add_to_play_list(audio_file)   file_path, file_name = os.path.split(audio_file)   self.list_box.insert(tk.END, file_name)

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required