#!/usr/bin/perl use strict; use Tk; use Tk::ProgressBar; my $mw=MainWindow->new; my $percent; my $pb=$mw->ProgressBar( -height => 0, -width => 20, -length => 100, -colors=>[0,'blue'], -blocks=>100, )->pack; my $btn=$mw->Button( -command => \&show_progress, -text => 'Run program', )->pack; MainLoop; sub show_progress{ for (1..100) { $percent=rand(100); $pb->value($percent); } }