in reply to TK::ProgressBar and update memory build up

Yeah the Progressbar has repeated use issues. One way is to use the value method, this dosn't leak for me on linux after repeated clicks, but may leak if run from a timer. .
#!/usr/bin/perl use strict; use Tk; use Tk::ProgressBar; my $mw=MainWindow->new; my $percent; my $pb=$mw->ProgressBar( -height => 0, -width => 20, -length => 100, -colors=>[0,'blue'], -blocks=>100, )->pack; my $btn=$mw->Button( -command => \&show_progress, -text => 'Run program', )->pack; MainLoop; sub show_progress{ for (1..100) { $percent=rand(100); $pb->value($percent); } }
If you absolutely need alot of updates, and need to avoid memory gains, you can roll your own with a label. You can get the width right by playing around. No leaks at all on linux.
#!/usr/bin/perl use strict; use Tk; my $mw=MainWindow->new; my $percent; my $pb= $mw->Label( -bg => 'white', -fg => 'blue', -width => 60, -justify => 'left', -anchor => 'w', )->pack(); my $label1 = $mw->Label( -textvariable=> \$percent, )->pack(); my $timer = $mw->repeat(10,\&show_progress); MainLoop; sub show_progress{ $percent += 1; if($percent >= 100){$percent = 0} my $str = '|' x $percent; $pb->configure(-text => $str ); }

I'm not really a human, but I play one on earth CandyGram for Mongo