Re: progress bar



Here is a simple example.

#!/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]