Re: ProgressBar doesn't pulse



Am Sonntag 14 Januar 2007 04:21 schrieb muppet:
On Jan 13, 2007, at 5:54 PM, Ben Staude wrote:
Any ideas why it doesn't work? Is this related to some Gtk/KDE
"interaction"?

This typically happens when you don't return control the main loop.
Does your program respond at all while it's supposed to be pulsing?

I am using this as test code (was posted by zentara here: 
http://www.mail-archive.com/gtk-perl-list gnome org/msg00854.html):

#!/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 (10,\&show_progress);
# timer will run until callback returns false 

Gtk2->main;

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

This test script does work as expected on another Linux machine (running 
Debian Sarge with KDE), but the progressbar looks different (more like gnome, 
whereas on Kubuntu (where it doesn't work), they have some KDE integration of 
gtk and therefor a KDE progressbar).

You might also try setting the pulse step.  The default is 0.1, but
you may need a different value for some reason or another.  Difficult
to tell without more information.

Maybe the code above helps sorting out programming issues (as the test script 
isn't mine:-)). Besides this, I don't know in which direction to search for 
the cause or provide information? Maybe someone on the list can run the test 
script on their Kubuntu to find out whether it's related to that?

Thanks a lot,

Ben


                
___________________________________________________________ 
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de



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