#!/usr/bin/perl -w use Tk; use Tk::Pane; $mw=MainWindow->new(); $mw->geometry("100x100"); $mw->Button(-text=>"START",-command=>\&start_computation)->pack; MainLoop; sub start_computation { $progress=$mw->Toplevel(); $progress->geometry("100x100"); $pane=$progress->Scrolled('Pane',-scrollbars=>'osoe')->pack(-fill=>'both',-expand=>1); $text="Computation started...\n"; $label=$pane->Label(-text=>$text)->pack(-anchor=>'nw'); # doing several computation steps foreach$step(1..10) { sleep(1); $text.="Step $step finished.\n"; $label->destroy; $label=$pane->Label(-text=>$text)->pack(-anchor=>'nw'); $pane->update; } $text.="\nComputation finished.\n"; $label->destroy; $label=$pane->Label(-text=>$text)->pack(-anchor=>'nw'); $pane->update; $pane->Button(-text=>"QUIT",-command=>sub{exit;})->pack; }