Re: Progress bar help



On Fri, 20 Jan 2006 10:05:06 -0600
Daniel Davidson <danield igb uiuc edu> wrote:

Can someone also explain to me what pluse does?  I think I know but I am
not sure.
Here is a simple pulse snippet.
#!/usr/bin/perl
use warnings;
use strict;
use Gtk2;

Gtk2->init();
my $window = new Gtk2::Window;
my $pbar = new Gtk2::ProgressBar;
   $pbar->set_pulse_step(.1);

# set_text not allowed in pulser
# !  $pbar->set_text('foobar');

my $vb = new Gtk2::VBox(0, 0);

my $b = new Gtk2::Button('Quit');
$window->add($vb);
$vb->add($pbar);
$vb->add($b);

$b->signal_connect('clicked', sub {Gtk2->main_quit});
$window->signal_connect('destroy', sub {Gtk2->main_quit});

$window->show_all();

my $timer = Glib::Timeout->add (100,\&show_progress);
# timer will run until callback returns false

Gtk2->main;

#####################################################
sub show_progress{
     $pbar->pulse();
return 1;
}
__END__



-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html



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