Gtk2::ImageMenuItem with a custom icon



Hi all.

How do I go about creating a Gtk2::ImageMenuItem with a custom icon?
I can do:

my $menu_item = Gtk2::ImageMenuItem->new_from_stock("gtk-index");

to create one with the gtk stock icon for 'find', but I want to use my
own Gtk2::Gdk::Pixbuf. Well actually I'd be happy if I could use the one
that comes with the above command, but I want to use my own text instead
of 'index'. Either way.

I've tried:

my $menu_item = Gtk2::ImageMenuItem->new;
my $pixbuf = $form->render_icon( "gtk-index", "menu");
$menu_item->set_image($pixbuf);

But the last line complains that $pixbuf is not of type Gtk2::Widget.

-- 
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak nusconsulting com au
website: http://www.nusconsulting.com.au



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