From: Hidetoshi NAGAI Date: 2010-04-05T07:03:55+09:00 Subject: Re: Tk delay From: Jesse Jurman Subject: Re: Tk delay Date: Sun, 4 Apr 2010 03:40:47 +0900 Message-ID: <6f928e01e551a8081eb1f1d54a246b9c@ruby-forum.com> > I'm using the Snack audio toolkit for ruby, so I already know how long > the song is... I don't need to constantly check if the song is > playing... I just need to have a block of code run after a set number of > seconds. Snack toolkit can call a callback procedure at end of the sound. Isn't it enough for your purpose? I don't know Snack for Ruby (rbsnack) library. Even if rbsnack doesn't support such callback, you can call the feature of Tcl/Tk from Ruby/Tk (if your Tcl/Tk can load Snack, and your Ruby/Tk loads the Tcl/Tk's libs). For example, ----------------------------------------- sndname = 'foobar' Tk.tk_call('snack::sound', sndname, '-file', sndfile, '-fileformat', fmt, ...) Tk.tk_call(sndname, 'play', '-callback', proc{puts "end of the sound"}) ----------------------------------------- -- Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)