in reply to Give me my gui back!
Hope this helps. Try the following demo code, first run it as is, then comment out that $mw->update() line, run it again, and see what happens.
(When you try it, you may want to adjust those big numbers base on the speed of your machine.)
use Tk; use Tk::ProgressBar; use strict; use warnings; my $count; my $mw = new MainWindow(-title => "demo"); $mw->Button(-command => [\&a_long_process, \$count], -text => "A Long +Process")->pack(); my $pb = $mw->ProgressBar( -from => 0, -to => 100000, -blocks => 100000, -colors => [0, 'green', 30000, 'yellow' , 60000, 'red'], -variable => \$count )->pack(); MainLoop; sub a_long_process { my $hash = {}; for (0..100000) { $hash->{$_} = $_; $count ++; $mw->update(); #try to comment and uncomment this ; } }
|
|---|