#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::ActivityBar; my $mw = MainWindow->new; my $activity = $mw->ActivityBar(-anchor => 'w')->pack(-expand => 1); $mw->Button(-text => 'Start Activity', -command => sub{ $activity->startActivity(); #start the bar my $timer = $mw->after(6500, sub{ $activity->configure('-value' => 0); } ); &do_it; })->pack(); $mw->Button(-text => 'Exit', -command =>sub{ exit })->pack(); MainLoop(); sub do_it{ # you need to fork your command or it will block the gui # from functioning if(fork == 0){ system("date; sleep 2; date; sleep 2; date; sleep 2"); } }