#! perl -slw use strict; use threads qw[ async ]; use Tk; use Tk::ProgressBar; use Tk::ROText; my $cmd = 'perl -le" print for 1 .. 10; sleep 10; exit 123"'; my $mw = MainWindow->new; my $pb = $mw->ProgressBar()->pack(); my $txt = $mw->ROText( -width => 3, -height => 1, )->pack( -side => 'left' ); my $edit = $mw->Entry( -width => 80, -textvariable => \$cmd )->pack( -side => 'left' ); my $btn = $mw->Button( -text => 'Doit', -command => sub{ async{ system $cmd; $txt->Contents( $? >> 8 ); }; } )->pack( -side => 'left' ); my $progress = 0; my $repeat = $mw->repeat( 100 => sub{ $progress = 0 if ++$progress == 100; $pb->value( $progress ); } ); MainLoop;