The short answer is
$widget -> update;
A longer answer would include a script of this sort where instead of actually
doing something useful the "long running process" is simply a call to the perl
sleep() function:
#!/usr/bin/perl -w
use Tk;
my $m = MainWindow->new();
my $l = $m -> Listbox();
$l -> bind('<Double-1>' => sub{sleepy($l)} );
my @nuts = qw(Almond Brazil Chestnut Doughnut Elmnut Filbert);
for (@nuts) { $l -> insert('end',$_); }
$l -> pack;
MainLoop;
sub sleepy {
my $widget = shift;
print "before 1st sleep \n";
sleep(10);
print "after 1st sleep before delete \n";
$widget -> delete('active');
$widget -> update; # try [un]*commenting this
print "after delete before 2nd sleep \n";
sleep(10);
print "after 2nd sleep \n";
}
__END__
Previous | Return to table of contents | Next