Re: ProgressBar doesn't pulse



On Mon, 15 Jan 2007 18:21:30 +0100
Ben Staude <sben1783 yahoo de> wrote:

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

I just ran the example, on my linux box, and it pulses very fast. If I set the
timer interval to 1 (very fast), it seems to sputter. So my thought is that with all the
KDE bloat in kbuntu, running the timer at 10, is too fast for the system to
update the screen, so it appears not to work.

Try setting the timer to 100,  500, or even 1000 and see if kbuntu can
keep up.

my $timer = Glib::Timeout->add (500, \&show_progress);

zentara


-- 
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]