Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi! I'm using Gtk2, and i wanted to create a loading screen using gif images. This is what i did to play the animation.
my $anim = Gtk2::Gdk::PixbufAnimation->new_from_file($img_path); my $image = Gtk2::Image->new_from_animation($anim);
This works ok if the program is IDLE. But since im loading something (converting PSD to JPG) the program is busy and does not play the animation. I cannot use the,
while (Gtk2->events_pending()) {Gtk2->main_iteration();}
because the process of converting the image is a single line. (no loops)

Replies are listed 'Best First'.
Re: Pixbuf Animation
by Anonymous Monk on May 05, 2009 at 02:34 UTC
    you'll need to use system or fork/threads
      is there another way? maybe a timeout??
        No. What's happening here is your long image conversion prevents the GTK events from being processed. This behavior is the same in any other windowing toolkit. The best way to get around this, as the other Anonymous Monk has already said, is to run your conversion process in another thread.