Cool this works, I was working on the threading idea but this is much simpler. Earlier i had tried the after function but I had it tied to the frame object instead of the root object which made it not work for some reason. Thanks a lot for the help!
Michael Lange wrote: > > Hi, > > On Mon, 18 Jan 2010 15:57:06 -0800 (PST) > skizm <shawn.me...@gmail.com> wrote: > >> >> I am currently trying to write a code snippet that will record for a >> set period of time and I have tried a number of methods to do this >> yet none have worked, the first one I tried is listed below. >> >> from Tkinter import * >> import time >> root = Tk() >> >> import tkSnack >> tkSnack.initializeSnack(root) >> c = tkSnack.Sound() >> c.record() >> time.sleep(5) #record for 5 seconds >> c.stop() >> >> This produces an apparently empty sound file, I assume that what is >> going on here is that the sleep command pauses the entire program >> including what I am trying to record. I am sure that there is some >> proper way to do this but after searching for quite a while I am at a >> loss as to what it may be. In addition to the sleep I have tried >> the .after(...) member function of the master object. I have tried >> this with a record and stop button and it works fine. > > with this slightly modified example I get the expected 5 second sound > file; doesn't this work for you ? > > from Tkinter import * > import tkSnack > > root = Tk() > tkSnack.initializeSnack(root) > c = tkSnack.Sound(file='test.wav') > c.record() > root.after(5000, c.stop) > root.mainloop() > > Michael > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss@python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > -- View this message in context: http://old.nabble.com/tkSnack-record-for-specific-period-of-time-tp27218833p27231852.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss