From: Hidetoshi NAGAI Date: 2010-04-05T10:56:07+09:00 Subject: Re: Tk delay From: Jesse Jurman Subject: Re: Tk delay Date: Mon, 5 Apr 2010 09:52:20 +0900 Message-ID: <21d3bcf0a32d7d410257b96c5d48d6e8@ruby-forum.com> > 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"}' interval argument of TkTimer can accept a proc object. The proc is called when decide the interval time for the next call. So, the proc must return a milisecond value of integer. For example, ------------------------------------------------ evloop = Thread.new{Tk.mainloop} ary = [500, 1000, 2000, 4000] TkTimer.new(proc{tm = ary.shift; ary.push(tm); tm}, -1){puts :hoge}.start evloop.join; exit ------------------------------------------------ -- Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)