insaniac has asked for the wisdom of the Perl Monks concerning the following question:
I'm building a tool which will allow me to modify/set EXIF information for images (and prolly more in the future). This is my very first Gtk2 application. I've found the gtk-perl tutorial and I also know where to look up the API.
The subject is somewhat misleading: I *do* know how to create thumbnails et al., my problem is: my application freezes when I'm generating the thumbs, and of course, when all thumbs are generated, *pling* the application is back.
How can I avoid this, and maybe use a Gtk2::ProgressBar to indicate that thumbs are being generated.
Or even better: how can update/redraw my application to show thumbs when they're being generated? So that you seem them appearing one at a time.
Ideas, hints, ... everything will be appreciated ;-)
Thanks!!
for my $image (@images) { last if $total_count++ == 55; if(not $count){ $thumb_line = Gtk2::HBox->new(FALSE,1); $thumb_page->pack_start($thumb_line,FALSE,FALSE,5); } print "Thumbing ". $image->name."\n"; my $pixbuf = Gtk2::Gdk::Pixbuf->new_from_file ($image->name); my ($width,$height) = ($pixbuf->get_width, $pixbuf->get_height +); my ($scale_width,$scale_height) = $width > $height ? (80,70) : + (70,80); my $new_pixbuf = $pixbuf->scale_simple($scale_width,$scale_hei +ght,'GDK_INTERP_BILINEAR'); my $event_box = Gtk2::EventBox->new; $thumb_line->add($event_box); $event_box->show; my $image_widget = Gtk2::Image->new(); $image_widget->set_from_pixbuf($new_pixbuf); $image_widget->set_size_request(80,80); $image_widget->show; $event_box->add($image_widget); $event_box->signal_connect('button_press_event',\&image_clicke +d_event, $image->name); $event_box->window->set_cursor(Gtk2::Gdk::Cursor->new('hand1') +); $thumb_line->show; #$pbar->pulse(); #$pbar->show; $count = 0 unless ++$count < 10; $window->show; }
to ask a question is a moment of shame
to remain ignorant is a lifelong shame
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Gtk2-perl: Create thumbnail pages
by phenom (Chaplain) on Aug 26, 2005 at 11:11 UTC | |
by insaniac (Friar) on Aug 26, 2005 at 11:19 UTC |