#!/usr/bin/perl -w use Tk; use Tk::ExecuteCommand; use strict; my $mw = MainWindow->new; #create and hide toplevel############ my $tl = $mw->Toplevel(); $tl->withdraw; my $snaptext = $tl->Scrolled('Text', -background=>'lightsteelblue', -foreground=>'black', )->pack(); $tl->Button(-text =>'Close', -command => sub{$tl->withdraw })->pack(); ####################################### my $ec = $mw->ExecuteCommand( -command => '', -entryWidth => 50, -height => 10, -label => '', -text => 'Execute', )->pack; my $dtext = $ec->Subwidget('text'); $dtext->configure( -background => 'black', -foreground => 'yellow', ); $mw->Button(-text => "Snap Shot", -command => sub{ my $time = localtime; my $old_y_view = $dtext->index('end'); print "$old_y_view\n"; my $gettext = $dtext->get('end -10 lines', 'end'); print "gettext->$gettext\n"; $snaptext->insert('end',"\n##$time\n$gettext\n###end $time\n"); $snaptext->see('end'); $tl->deiconify; })->pack(); $ec->configure(-command => './test'); $ec->execute_command; MainLoop;