in reply to Tk::ExecuteCommand stop scrolling

On further thought, trying to force the text scroll view to a line number, while something else is sending it to the 'end', is asking for "jitter". I think your intent is to be able to "freeze and read" something of interest in the output. What your best option would be, is to have a button which makes a copy of the the text, at the instant, and opens it as a copy in a second text box in another toplevel window. That way you can take your time to read it, and not interfere with the output. If you need help on how to open a toplevel, with a copy of the text, let us know.

I'm not really a human, but I play one on earth. flash japh

Replies are listed 'Best First'.
Re^2: Tk::ExecuteCommand stop scrolling
by dzon (Novice) on Jul 06, 2005 at 07:11 UTC
    Really thanks for your comments!
    I'm a beginner with Perl/Tk so what you mean by "asking for "jitter""?
    If it's not possible to make it in the same window without changing the ExecuteCommand module or in some other difficult way, I like also that idea with that another toplevel widget.
    So please can you help me how to open a toplevel, with a copy of the text?
    Thanks!
      By "jitter" I mean the visual effect of 2 different subs trying to move the scrollbar to different points. If you watch it, the scrollbar handle will look like a little Mexican Jumping bean. :-) Here is an example. First the test script, followed by the Tk code.
      ### test script #!/usr/bin/perl use warnings; use strict; $|++; for (1..10000){ print "$_\n"; select(undef,undef,undef,.1); } __END__ ######################################## #!/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 $gettext = $dtext->get('end -10 lines', 'end'); $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;

      I'm not really a human, but I play one on earth. flash japh