use Tk; $total_objects = 303; $progressbar_width = 2*$total_objects; $progressbar_height = 50; my $main = MainWindow->new; $canvas1 = $main->Canvas( '-width' => $progressbar_width, -height => $progressbar_height, -background => 'black', -command => sub {print "oh shit"} ) -> pack; $canvas1->create ('rectangle','0','0',10,$progressbar_height,-fill=>'red'); MainLoop; sub myupdatefunk { }