playing WAV files in python using Snack
So I开发者_高级运维 downloaded Snack and put the Snacklib in python/tcl and put the tkSnack.py into python/Lib but i still dont get any sound. I'm not getting any errors but im still not getting any sound.Here's my code...
from Tkinter import *
from tkSnack import *
root = Tk()
tkSnack.initializeSnack(root)
snd = Sound()
snd.read('ex1.wav')
snd.play()
If anyone has any advice it would be greatly appreciated.
Shouldn't you be adding the mainloop for tk?
from Tkinter import *
from tkSnack import *
root = Tk()
tkSnack.initializeSnack(root)
snd = Sound()
snd.read('ex1.wav') <--- Also good to give full path to file
snd.play()
root.mainloop() <------ main loop
See the manual, it suggests other ways of loading too.
snd = tkSnack.Sound(file='ex1.wav')
精彩评论