I designed a gui with glade constisting of a file chooser dialog and an image widget. I want to select an image file and display the image. When I catch the file select signal the image is not set to the new image, but the missing icon symbol is displayed.
Sometimes a short break from staring at the code does wonder.#!/usr/bin/perl # # use strict; use warnings; use Glib; use Gtk2 -init; my $builder = Gtk2::Builder->new(); $builder->add_from_file("image_gtk.glade"); $builder->connect_signals(undef); Gtk2->main; sub filechooserbutton1_file_set_cb { my $filename = shift @_; my $image = $builder->get_object('image1'); $image->set_from_file($filename);# wrong $image->set_from_file($filename->get_filename); #right, this makes + it work }
In reply to How to show selected image with gtk2? by walto
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |