Re: a bunch of questions about displaying jpegs



On Sat, 2003-08-16 at 21:42, Gavin Brown wrote:

my $pixbuf = Gtk2::Gdk::Pixbuf->new_from_file($file);

this actually throws errors via croak, so you can trap missing files
without disrupting your logic:

eval {
        my $pixbuf = Gtk2::Gdk::Pixbuf->new_from_file ($file);
        # do fun stuff like scale, rotate, whatever
        # without worrying about whether new_from_file succeeded
};
if ($@) {
        # you get here if new_from_file failed.
        # $@ contains the error string, do
        # something about it.
}

my $image = Gtk2::Image->new_from_pixbuf($pixbuf);

and then to change the picture after the GtkImage is created, you just
do

$image->set_from_pixbuf ($pixbuf);


-- 
muppet <scott at asofyet dot org>




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