You need to force an update of the widget, e.g.:
sub progress {
for my $i (0..15) {
sleep(1);
$counter->configure(-text=>$i);
$main->update;
}
}
-D
-----Original Message-----
From: roboz [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 21, 2002 10:01 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED];
[EMAIL PROTECTED];
[EMAIL PROTECTED]; perl-win32-web@listserv.
ActiveState. com EE-mail"; [EMAIL PROTECTED]
Subject: (no subject)
Hi All,
Please help me! Why doesn't the counter label count in real time in
my Tcl/tk Perl script, though I configure the '$counter' label at all
changes of the "$i" variable.
Thanks: R. Beci
_____
#!/usr/bin/perl -w
use strict;
use Tk;
$|=1;
# Create main window
my $main = MainWindow->new;
# Add a Label and a Button to main window
$main->Button(
-text => 'Start',
-command => sub {progress()}
)->pack;
my $counter=$main->Label(
-text=>"0"
)->pack();
# Spin the message loop
MainLoop;
sub progress {
for my $i (0..15) {
sleep(1);
$counter->configure(-text=>$i);
}
}
_____
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl