#!/usr/bin/perl use warnings; use strict; use Tk; use Proc::Background; my $mw = MainWindow->new; my $msg = $mw->Label(-text => 'Press the button once ready.')->pack; my $button = $mw->Button(-text => 'Start', -command => \&run, )->pack; MainLoop(); sub run { my $proc = Proc::Background->new('kate'); # an editor $mw->update while $proc->alive; $mw->Label(-text => 'Finished.')->pack; $button->destroy; }