Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: Tk::ProgressBar --Reset it?

by amonotod (Acolyte)
on Jul 09, 2004 at 15:01 UTC ( [id://373160]=note: print w/replies, xml ) Need Help??


in reply to Re: Tk::ProgressBar --Reset it?
in thread Tk::ProgressBar --Reset it?

Here is the now working code that is closer to what I am doing...
#perl -w use strict; my ($display, $progress, $percent_done, $progress_bar_set, $mw, $lblTe +xt, $display, $line, $count); &CreateDisplay; $line = 1; while ($line < 30) { $display->insert('0.0', "Line $line\n"); $mw->update; $count = 1; while ($count < 50) { $percent_done = $count * 2; $mw->update; $count++; sleep 1; } $line++; sleep 2; } sub CreateDisplay { use Tk; use Tk::Text; $mw = MainWindow->new(-title => 'Progress bars'); create_progressbar(); $lblText = $mw->Label(-text=>"This is a test of multiple progress ba +rs...")->pack(-side => 'top'); $display = $mw->Text(-height => '25', -width => '100',)->pack(-side +=> 'bottom', -expand => '1', -fill => 'both'); $display->insert('0.0', "Starting line\n"); $mw->update; } sub create_progressbar { use Tk::ProgressBar; $progress = $mw->ProgressBar( # create a progress bar for reference -length => 100, -width => 20, -from => 0, -to => 100, -blocks => 100, -colors => [0, 'blue'], -variable => \$percent_done )->pack(-fill => 'x'); }
The missing ingredient was the the $mw->update after each $percent_done incremement. It worked while increasing, but just didn't when decreasing, for some reason.....

Thank you for the help,
amonotod

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://373160]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-04-26 03:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found