1
Perl / Вопрос к мастерам Perl/Tk под Win32
« : 24 Октября 2006, 16:48:15 »
use strict;
use Tk;
use Tk::ProgressBar;
my $parent = MainWindow->new(-title => \'Save\');
my $percent_done = 0;
my $position = 10;
my $progress = $parent->ProgressBar(
-width => 20,
-length => 200,
#-anchor => \'s\',
-from => 0,
-to => 100,
-blocks => 10,
-colors => [0, \'green\', 50, \'yellow\' , 90, \'red\'],
#-variable => \\$percent_done
)->pack();
my $ida = $parent->repeat(500, \\&_repeat);
MainLoop;
sub _repeat{
$progress->value($position);
if(($position += 10) > 100){
$parent->afterCancel($ida);
}
}
use Tk;
use Tk::ProgressBar;
my $parent = MainWindow->new(-title => \'Save\');
my $percent_done = 0;
my $position = 10;
my $progress = $parent->ProgressBar(
-width => 20,
-length => 200,
#-anchor => \'s\',
-from => 0,
-to => 100,
-blocks => 10,
-colors => [0, \'green\', 50, \'yellow\' , 90, \'red\'],
#-variable => \\$percent_done
)->pack();
my $ida = $parent->repeat(500, \\&_repeat);
MainLoop;
sub _repeat{
$progress->value($position);
if(($position += 10) > 100){
$parent->afterCancel($ida);
}
}