From: Summercool Date: 2007-09-26T13:06:36+09:00 Subject: Re: how to use Ruby / Tk to display a text message status box On Sep 23, 2:46 pm, SpringFlowers AutumnMoon wrote: > how can we pop up aTkwindow to display the temporary results of a > program? > > 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. someone in the Tcl/Tk newsgroup posted a program to do that. i don't know the exact Ruby / Tk equivalent right now, but here is the code that will work in Perl: use warnings; use strict; use Tk qw/tkinit DoOneEvent exit DONT_WAIT ALL_EVENTS/; use POSIX qw(strftime); my $mw = tkinit; my $text=$mw->Text()->pack(); my $I; my $J = 0; while (1) { $mw->DoOneEvent( DONT_WAIT | ALL_EVENTS ); if ( ++$I > 10000 ) { #slows things down use 1 for max speed $text->delete("1.0", 'end'); $text->insert('end',"And this is GUI $J "); my $now_string = strftime "%a %b %e %H:%M:%S %Y", localtime; $text->insert('end',"\ntime is $now_string "); print "command line $J "; $I = 0; $J++; } }