$mw->Label(-text => "Path:")-> grid( -row => 0, -column => 0, -sticky => 'w'); my $pathEntry = $mw->Entry(-width => 50, -textvariable => \$full_path)-> grid( -row => 0, -column => 1, -sticky => 'w'); $mw->Button(-text => "Browse...", -command => sub {print $full_path})-> grid( -row => 0, -column => 2, -sticky => 'n'); $mw->Button(-text => "Add/Update!", -command => [\&addUpdateButtonPressed])-> grid( -row => 1, -column => 1, #-columnspan => 3, -sticky => 'n'); $mw->Label(-text => "Progress:")-> grid( -row => 2, -column => 0, -sticky => 'w'); $progressLabel = $mw->Label(-text => "0 / Unknown")-> grid( -row => 2, -column => 1, -sticky => 'n'); my $variable = 24; $progressBar = $mw->ProgressBar( -width => 16, -length => 400, -anchor => 'w', -from => 0, #-to => 100, -blocks => 10, -gap => 0, -colors => [0, 'green', 50, 'yellow' , 80, 'red'], -variable => \$statics{'files'} )-> grid( -row => 3, -column => 0, -columnspan => 3, -sticky => 'n'); ¢erWindow($mw, 410, 100); $pathEntry->focus; MainLoop; sub addUpdateButtonPressed { print "Getting statics from: " . $full_path . " ...\n"; my $total_files = &countFilesTotally($full_path); print "Files found: " . $total_files . "\n"; $statics{'files'} = 0; $progressLabel->configure(-text => "0 / " . $total_files); $progressBar->configure(-to => $total_files); $progressBar->repeat(500, sub {$progressBar->update}); #threads->create("recursive", $full_path); &recursive($full_path); } sub recursive { my $dir = shift; .. do alot of stuff ... }