in reply to Progress bar in Tk

I'd like to use the progress bar included here in the subroutine in my script but I don't know where to put the call backs to track time. In this example below they just use a loop and count down. I can do that but it won't be an accurate representation to track with I'm doing.

What does that mean?

Maybe this helps TK::ProgressBar Color update , to track progress, you simply increment a counter

#!/usr/bin/perl -- use strict; use warnings; use Tk; use Tk::ProgressBar; my $mw = tkinit; my @files = 1 .. 123; my $status_var = 0; my $start_count = 0; my $finish_count = int @files; my $end_count = $finish_count - ( $finish_count / 3 ); my $middle_count = int( $finish_count / 3 ); my $resolution = 1; my $blocks = 10; $mw->ProgressBar( -borderwidth => 2, -relief => 'sunken', -width => 20, -padx => 2, -pady => 2, -variable => \$status_var, -colors => [ $start_count => 'green', $middle_count => 'yellow' , $end_count => 'red', ], -resolution => $resolution, -blocks => $blocks, -anchor => 'w', -from => $start_count, -to => $finish_count, )->pack( -fill => 'both', -expand => 1 ); $mw->Scale( -from => $start_count, -to => $finish_count, -variable => \$status_var, )->pack; $mw->raise; for my $file ( @files ){ some_thing( $file ); $status_var++; $mw->update; } $mw->Button( -text => 'Go', -command => [ \&status_from_zero, \$status_var ], )->pack; MainLoop; sub status_from_zero { use Time::HiRes qw( usleep ); $status_var = 0; for( 1 .. 200 ){ $status_var++; usleep( 1000 ); #~ $Tk::widget->parent->update; $Tk::event->W->parent->update; } } sub some_thing { use Time::HiRes qw( usleep ); usleep( 1000 ); } __END__