Unable to see the icon with Gtk2::ImageMenuItem



What am I doing wrong in the following code ? I searched around quite a bit but couldn't figure
out.

In the following code, my intention is to create a menu with two items in it. I'd like to have
pretty icons attached to each menuitem too.

I can see both the items in the menu, but only the first one has the icon (the home icon) and text
 ('Home') attached to it. The second one has only the text ('Save the world'), but no icon
attached to it. I guess I am not using the set_image in the right fashion.

my $menu = Gtk2::Menu->new();
my $menuitem1 = Gtk2::ImageMenuItem->new_from_stock('gtk-home', Gtk2::AccelGroup->new);
my $menuitem2 = Gtk2::ImageMenuItem->new("Save the world");     
$menuitem2->set_image(Gtk2::Image->new_from_stock ('gtk-save', 'GTK_ICON_SIZE_MENU'));
$menuitem1->show();
$menuitem2->show();
$menu->append($menuitem1);
$menu->append($menuitem2);


        
                
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 



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