from Tkinter import *
import sys
import tkMessageBox 
import winsound
import wave

filename=r"C:\15 KIT-HIP15\KIT 76-01.wav"

def die():
    sys.exit(0)

def callee():
    print "I was called; few are chosen"

def about():
    r = tkMessageBox.askyesno("tkmenu","this is a menu example")

    if r == 1:
        tkMessageBox.showinfo("tkmenu","you answered 'Yes'")
    else:
        tkMessageBox.showinfo("tkmenu","you answered 'No'")

def sound():
    global filename
    winsound.PlaySound(filename, winsound.SND_FILENAME)

def wavinfo():
    global filename
    w = wave.open(filename, 'r')
    numsamps = w.getnframes()
    chans = w.getnchannels()
    if chans == 1 :
        chan = "mono"
    elif chans == 2:
        chan = "stereo"
    freq = w.getframerate()
    detail = "Details for %s:\n%s, %i, %i frames" % (filename,chan,freq,numsamps)
    
    tkMessageBox.showinfo("tkmenu",detail)
    w.close()
    


        
root = Tk()
bar = Menu(root)

filem = Menu(bar)
filem.add_command(label='sound...', command=sound)
filem.add_command(label='sound properties...', command=wavinfo)
filem.add_command(label='save...', command=callee)
filem.add_command(label='save ass...', command=callee)
filem.add_separator()
filem.add_command(label='Exit', command=die)

helpm = Menu(bar)
helpm.add_command(label='Index...', command=callee)
helpm.add_separator()
helpm.add_command(label='About', command=about)

bar.add_cascade(label='file', menu=filem)
bar.add_cascade(label='help', menu=helpm)

root.config(menu=bar)
root.mainloop()


