Re: [gtk-list] FAQ 5.11 (Why doesn´t myprogressbar upate) with gtk-perl
- From: "BrYan P. Johnson" <bilko onebabyzebra com>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] FAQ 5.11 (Why doesn´t myprogressbar upate) with gtk-perl
- Date: 21 Oct 1999 12:33:18 -0400
>>>>> "Ramin" == Ramin Motakef <ramin@uni-oldenburg.de> writes:
> Hi! Im just starting my second program with perl-gtk (Newbie alert!!)
> and need some help. The program reads a big (ca. 2MB) Datafile wich
> takes quite some time, so i would like to give the users some feedback
> that "there is something going on" with a Gtk::ProgressBar:
while(defined($line = <DATA> )){ if ($i % 100 == 0) {
$val=($i/($count)); $pbar->update($val); while
(Gtk::Gdk->events_pending) {
main_iteration;
print SDTERR "Pending...\n"; } } $i++; do_something... }
> This doesn´t work. The progressbar doesn´t update, althoug some (~10)
> "Pending..."s are printed on STDERR. so the questiions are:
> - Is this the correct list for gtk-perl questions? (If not: sorry..)
> - Why doesn´t the code work?
> - Is there another way to do it?
I don't know why it doesn't work, but I was unable to get the statusbar to
update when I tried something similar. Here's what I use:
&spin_pbar($pbar, $speed, $topval);
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;
}
BrYan
--
Triangle Man hates Particle Man.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]