use strict; use warnings; use Tk; my $top = new MainWindow; $top->Button( -text => 'Start LongTime.exe', -command => \&longtime ) ->pack; my $diag = $top->Dialog( -text => 'Working...', -buttons => [] ); MainLoop; sub longtime { $diag->after( 100, sub { system('longtime.exe'); $diag->{selected_button} = 1 } ); $diag->Show(); }