From: SpringFlowers AutumnMoon Date: 2007-09-26T21:08:44+09:00 Subject: Re: how to use Ruby / Tk to display a text message status box > SpringFlowers AutumnMoon wrote: > > If our program is running and displaying its intermediate calculations, > instead of showing the final result at the end, i hope to have aTk > window just to show the semi-final results. the following program can do what the Perl program can do. right now i don't know Tk enough to check when the GUI window is closed by the user and therefore don't do any text update. require 'tk' tk = TkRoot.new text = TkText.new(tk).pack() i = 0 n = 10000 while i += 1 TclTkLib.do_one_event(TclTkLib::EventFlag::ALL | TclTkLib::EventFlag::DONT_WAIT) if i % n == 0 text.delete('1.0', 'end') text.insert('end', "This is GUI %d \n" % (i / n)) text.insert('end', "Time is %s" % Time.now.strftime("%Y-%m-%d %I:%M:%S")) printf "This is command line %d ", i / n end end -- Posted via http://www.ruby-forum.com/.