From: Hidetoshi NAGAI Date: 2006-03-28T01:45:46+09:00 Subject: Re: Callback For A Timer Event To Display Widget in Ruby/Tk From: David Bailey Subject: Callback For A Timer Event To Display Widget in Ruby/Tk Date: Mon, 27 Mar 2006 23:14:23 +0900 Message-ID: > But, I have searched high and low, and I can not find out how to set up > a callback for a timer event. I just want to display a time string on > the TkCanvas or TkTopLevel window once per second. I have gone through > a Perl/Tk reference book and I'm still having trouble figuring out how > to "translate" this into Ruby/Tk. For such case which is sensitive about interval time, I recommend TkRTTimer class ( available Ruby 1.8.3 or later). That is unique to Ruby/Tk. Please see "/ext/tk/sample/tkrttimer.rb". It shows the difference between TkTimer class and TkRTTimer class. =========================================================================== TkTimer :: TkTimer.new(inerval, -1, operation).start | operation | | operation | | operation | --+-----------+------------+-----------+------------+-----------+--> time-line | interval | | interval | TkRTTimer :: TkRTTimer.new(inerval, -1, operation).start | operation | | operation | | operation | --+-----------+---------+-----------+---------+-----------+--------> time-line | interval | interval | interval # argument '-1' means infinite loop =========================================================================== -- Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)