Hi {NULE}
<pr>Thanks a lot!! Here is what I came up with. Please comment on this!
<pr>
#!/usr/local/bin/perl use strict; use Tk; use Tk::DialogBox; use Tk::ProgressBar; my (@joblist, $job, $pid); # Get a list of all jobs currently running.. chdir(); open (IN, ".dractrack") or die "Can't open .dracktrack for input $!\n" +; while (<IN>){ chomp; push (@joblist, $_); } close IN; if (@joblist=""){print" dractrack - Nothing currently in the que!\n";} # For each new job create a window and display the stats foreach $job ( @joblist) { if( $pid = fork ) { } elsif( defined $pid ) { my %drac; ($drac{type},$drac{primary},$drac{rundir},$drac{printfile},$drac{h +ostname},$drac{stages}) = split / /, $job , 6; my $MW = new MainWindow(-title => "Vampire $drac{type} : $drac{pri +mary}"); my $progress = $MW->ProgressBar( -width => 25, -length => 300, -borderwidth => 2, -relief => 'flat', -width => 20, -padx => 2, -pady => 2, -colors => [0 => 'green', .8*$drac{stages}=>'yellow' , .9*$dra +c{stages} => 'red'], -resolution => 1, -blocks => 100, -anchor => "w", -from => 0, -to => $drac{stages}, )->pack(-fill=>"x"); my $stats = $MW->Label(-text=>"Type:$drac{type} Cell: $drac{prim +ary} Host: $drac{hostname} Total Stages: $drac{stages}", -font => '-b&h-lucida sans typewriter-medium-*-*-*-*-*-*-*-*-* +-*-*', -relief=>"sunken", -borderwidth=>2, -anchor=>"w")->pack; &CheckStage( $MW, $progress, $drac{rundir}, $drac{printfile}, $dra +c{stages}); MainLoop; exit; }else { die "Can't fork: $!"; } } # Delete .dractrack dir chdir(); open (DRACNEW, ">>.dracnew") or die "I think dracktrack is running"; rename (".dracnew", ".dractrack") or die "Can't replace .dracktrack.." +; sub CheckStage { my ($MW, $progress, $path, $log, $stages) = @_; my @lstage = 0; while ($lstage[3] < $stages){ open( LOG, "$path$log".".log" ) or die "Cannot open $path$log.log for input: $!\n"; while( <LOG> ) { chomp $_; next if ($_ !~ m/AT STAGE:/); @lstage = split /\s+/, $_; } close LOG; $progress->value($lstage[3]); $MW->update; sleep(1); } $MW->destroy; }

Once again thanks!


Rhodium

The <it>seeker</it> of perl wisdom.


In reply to Re: Re: Progress Bars TK::ProgressBars First time trying it.. by Rhodium
in thread Progress Bars TK::ProgressBars First time trying it.. by Rhodium

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.