use Tk; $main = MainWindow->new(); $button = $main->Button(-text => "step one", -command => \&fun); $button->pack(); MainLoop(); sub fun { $button->configure(-text => "step two" ); sleep 1; $button->configure(-text => "step three" ); }