my $kill_button = $mw->Button( -text => 'Stop', -command=> sub{ $exec->kill_command; } )->pack(); #### #!/usr/bin/perl use Tk; use Tk::ExecuteCommand; my $mw = MainWindow->new; $ec = $mw->ExecuteCommand( -command => '', -entryWidth => 50, -height => 10, -label => '', -text => 'Execute', )->pack; $ec->configure( -command => 'dir' ); $ec->execute_command; $ec->bell; $ec->update; # read perldoc Tk::ExecuteCommand for the Advertised Widget section my $ROText = $ec->Subwidget('text'); print "$ROText\n"; $ROText->configure(-bg=>'white'); $ROText->insert('end', "\n\nHi, this is a message\n\n"); $ROText->see('end'); #execute some perl code and output it to the text widget &do_something; MainLoop; sub do_something{ # the Tk::ExecuteCommand kill button won't stop this for (1..5){ $ROText->insert('end', "$_\n"); $ROText->see('end'); } }