use strict; use Tk; use Tk::ProgressBar; my $mw = MainWindow->new; my $top = $mw->Frame()->pack(); my $GoBtn = $top->Button(-text => 'Pop It!', -command => \&AddItem)->pack(); my $DoneBtn = $top->Button(-text => ' Exit ', -command => \&Cleanup)->pack(); my $progress = $top->ProgressBar( -width => 20, -length => 100, -anchor => 'w', -from => 0, -to => 9, -blocks => 1, -colors => [0, 'green'] )->pack(); $mw->focus; MainLoop; sub Cleanup { $mw->destroy; } sub AddItem { $GoBtn->configure(-state => "disabled"); for (0 .. 9) { sleep 1; $progress->value($_); $progress->update(); } $GoBtn->configure(-state => "normal"); $progress->value(0); $progress->update(); }