PatMar :
Can you add $text1->update() after your $text1->insert.
widget->update is like a refresh on other X11 windows manager.
CM Analyst a écrit :
Hi All,
I hope this is still the correct forum to get help
with Perl/Tk...
My goal is display the time in the GUI window but it
doesn't do it quite how I want it to.
In the GUI, I want the time to display with the sleep
call (set to 1). However, when I use the print
statement and the value goes to STOUT, the time value
displays as I want it to.
Can someone please tell me what I am missing here?
Thank you,
#########
use Tk;
use Time::Local;
my $main = MainWindow->new;
$main->Button (-text => 'Start', -command =>
\&display) -> pack (-side => "left")
-> pack (-anchor => "n");
$text1 = $main->Text ('-width' => 30, '-height' => 15,
'-background' => Grey,)
-> pack;
$main->Button(-text => 'Stop', -command => [$main =>
'destroy'])->pack;
sub display {
for (my $index = 0; $index <= 5; $index++ ) {
my ($sec, $min, $hour, $mday, $mon, $year, $wday,
$yday, $isdst) = localtime();
sleep 1;
#$text1->insert('end', "$hour:$min:$sec\n");
print ("$hour:$min:$sec\n");
}
}
MainLoop;
____________________________________________________________________________________
Don't let your dream ride pass you by. Make it a reality with Yahoo! Autos.
http://autos.yahoo.com/index.html
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/