Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl Progressbar

Status
Not open for further replies.

mfarrag

Programmer
Feb 16, 2012
2
US
Dear perl professionals,

I have a problem in my perl code. I am trying to create progressbar which will be able to adapt its color according to specific decision i.e. if ($x<10)
$progress->configure(-colors=>[10,"green"])
else
$progress->configure(-colors=>[10,"red"])

assume progressbar is already created with @colors=(0,'green') and -colors = \@colors

I am trying to run this code but it doesn't work. I will be thankful for your help
 
Hi

Perl standard distribution alone is not able to create progress bars.
In case you used a Perl module, please specify which.

By the way, in case you use the [tt]Tk[/tt] module, your code works for me. Of course, after correcting the elementary Perl syntax errors.


Feherke.
 
I am using tk::progressbar and there's no compilation errors but the color of progressbar is not changed.

Here's example
@colors = (0,'green');
$progress = $mw->ProgressBar(
-width => 20,
-length => 200,
-colors => \@colors,
-variable => \$progress,
)->pack();


if ($x<10)
$progress->configure(-colors=>(0,'green',10,'red'));
else
$progress->configure(-colors=>(0,'green',10,'yellow'));
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top