#!/usr/bin/perl -- use strict; use warnings; use Tk; my $mw = tkinit; my $labelvar = 0; $mw->Label(-textvariable=>\$labelvar )->pack; $mw->Button( -text => "Button", -command => sub { $mw->Busy; for( 1 .. 10){ $labelvar=$_; $mw->update; select(undef, undef, undef, 0.25);#sleep of 250 milliseconds } $mw->Unbusy; })->pack; $mw->MainLoop;