in reply to Updating a GUI with tail???
Here is a way to do it without the call to unix tail... My GUI does not freeze up with this code... Regards, Stacy. my $exit = 0; for (;;) { while ($line = <MLOG>) { $main->update; if ($line =~ m/estimate finish/) { $line =~ s/^\s+//; #remove leading whitespace $perc = (split(/\s+/, $line))[0]; chop($perc); #get rid of the "%" $perc = sprintf("%3.0f", $perc); $progress_label -> configure(-text => "Percent completed: $per +c%"); $progress_scale -> set($perc); $main->update; } elsif ($line =~ /extents written/) { $exit = 1 } else { next } }#end of while last if $exit == 1; seek(MLOG,0,1); $main->update; } close(MLOG);
|
|---|