From: Michael Fellinger Date: 2010-04-05T10:27:18+09:00 Subject: Re: Tk delay On Mon, Apr 5, 2010 at 9:52 AM, Jesse Jurman wrote: > Michael Fellinger wrote: >> On Sun, Apr 4, 2010 at 3:40 AM, Jesse Jurman >> wrote: >>> Jesse Jurman wrote: >>> >>>> Right now I need a means to delay the next song for the number of >>>> seconds that the current song is playing. >>> >>> 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. >> >> In stdlib Tk: >> ruby -rtk -e 'Tk.after(5000){ puts "hi" }; Tk.mainloop' >> >> In ffi-tk: >> ruby -rffi-tk -e 'Tk::After.ms(5000){ puts "hi" }; Tk.mainloop' > > Thanks, this works... but I can't get it to loop! I'm going to try using > this with a TkTimer widget... but is there perchance a loop option in > this widget as well? Something like TkTimer's loop? > i.e. 'TkTimer.start(5000, -1){puts "hi"}' tick = lambda{ puts "hi" Tk.after(5000, &tick) } Tk.after(5000, &tick) > -- > Posted via http://www.ruby-forum.com/. > > -- Michael Fellinger CTO, The Rubyists, LLC 972-996-5199