Re: [gtk-list] Re: FAQ 5.11 (Why doesn´t my progressbar upate) with gtk-perl



On Thu, Oct 21, 1999 at 12:33:18PM -0400, BrYan P. Johnson wrote:
> sub spin_pbar () {
>   my $pbar = shift || carp "No progressbar specified.\n";
>   my $speed = shift || 10;
>   my $topval = shift || 1;
>   $progress_timer = Gtk->timeout_add($speed, \&update_pbar, $pbar, $topval);
> }
> 
>  
> sub update_pbar {
> 	my($progressbar, $topval) = @_;
> 	my($new_val) = $progressbar->get_current_percentage;
> 
> 	if ($new_val>=$topval) {
> 	  return 0;
> 	}
> 	$new_val += 0.05;
> 	$progressbar->update($new_val);
> 	return 1;
> }

If you want the progress bar to update immediately add

while (Gtk->events_pending) {Gtk->main_iteration}
after $progressbar->update($new_val);

lupus

-- 
"You guys are definitely worth a wedding party." The Debian folks at ALS99



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]