#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::ProgressBar; my $mw = tkinit; my $btn = $mw->Button(-text => 'start...', -command => \&readdr)->pack(); MainLoop; sub readdr{ my $top = $mw->Toplevel(); my $progress = $top->ProgressBar(-from => 0, -to => 100, -colors => [0,'green'], -gap => 1)->pack(); opendir(DIR,'.') or die $!; while(my $file = readdir(DIR)){ my $values = $progress->value(); $progress->value($values+2); sleep(1); } closedir(DIR);