OKAY ... thank you for the advice to use strict (which is in the original code for this extracted example). I have modified this example code with the appropriate lines. It still works in the same undesired manner. Any hints towards what the real issue is?
#!/usr/local/bin/perl -w
use strict;
use Tk;
my $line = "";
my $submain = MainWindow->new();
my $status = $submain->Button(-text => 'Click to Clear',
-command => sub {$submain->destroy;}
);
$status->pack;
my $text1 = $submain->Text ('-width'=>100, 'height'=>20);
$text1->pack(-side => 'left', -fill => 'y');
$text1->insert('end', "start\n");
$text1->pack;
for(my $loop=0; $loop <= 3; $loop++ )
{
sleep 1;
print "$loop\n";
if ( $loop == 1 ) { $line = "$loop case 1\n"; }
elsif ( $loop == 2 ) { $line = "$loop case 2\n"; }
else { $line = "$loop something else\n"; }
$text1->insert('end', "$line");
$text1->pack;
}
MainLoop();
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|