#!/usr/bin/perl use strict; use Tk; use Tk::ProgressBar; # make window my $mw = new MainWindow(); # tell MainWindow to execute this function after 1000 milliseconds $mw->after(1000,\&MyUpdate); # or tell MainWindow to execute this sub repeatedly $mw->repeat(1000,\&MyOtherUpdate); MainLoop; sub MyUpdate { # ... start something? } sub MyOtherUpdate { # ... update window, reset progress bar? }