From: Jesse Jurman Date: 2010-04-05T09:52:20+09:00 Subject: Re: Tk delay 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"}' -- Posted via http://www.ruby-forum.com/.