Tkinter Sound (Python)

vegaseat 0 Tallied Votes 1K Views Share

The module tkSnack from our friends at KTH in Stockholm, Sweden allows you to play a variety of sound files using the Tkinter GUI. Supported sound files are WAV, MP3, AU, SND and AIFF formats.

# using tkSnack to play .wav .mp3 and .au sound files on Tkinter
# needs Python module  tkSnack  developed at KTH in Stockholm, Sweden
# free download: or later version
# from:
# on my system I copied to D:\Python24\Lib and the folder snacklib to D:\Python24\tcl
# tested with Python24      vegaseat      25jun2006

from Tkinter import *
import tkFileDialog
import tkSnack

form1 = Tk()
# have to initialize the sound system

def load_play_sound():
    mask_list = [("Sound files","*.wav *.au *.mp3")]
    sound_file = tkFileDialog.askopenfilename(initialdir='', filetypes=mask_list)
    sound1 = tkSnack.Sound(load=sound_file)

label1 = Label(form1, text='   using tkSnack to play .wav .mp3 and .au sound files   ')
button1 = Button(form1, text=' Load Sound ', command=load_play_sound)

yvos91 0 Newbie Poster

Does anybody knows how to use py2exe, and include tkSnack ???
I guess there is something with a 'packages' option, but I can't find any documentation.
Thank for your help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.