Hello,

My app has a tool-button with menu. I want to populate this menu with 
menu-items that have both a label and icon. The menu items appear but 
the images (icons) are not shown.

See this picture (tool button with menu + three menu-items shown)
http://bildr.no/view/616160

I know the icon filenames and images are ok, the menu just refuses to 
show them.
Here is the code:

# Get the tool button
tool_button = builder.get_object("toolbutton_other")
...
menu = gtk.Menu()
tool_button.set_menu(menu)

# Add 3 menu items; capture window item, capture camera picture, create 
empty image
for i in range(3):
     if i == 0:
         label = "Window item"
         filename = "capture_item.png"
     elif i == 1:
         label = "From webcam"
         filename = "capture_camera.png"
     else:
         label = "Empty image"
         filename = "capture_empty.png"

     # Add menu items
     menu = tool_button.get_menu()

     # Menu item with icon
     menu_item = gtk.ImageMenuItem()

     image = gtk.Image()
     image.show()
     filename = os.path.join(getdatapath(), 'media', filename)
     image.set_from_file(filename)

     menu_item.set_label(label)
     menu_item.set_image(image)
     menu_item.connect("activate", self.set_toolbutton_other, 
tool_button, filename)
     menu_item.show()
     menu.append(menu_item)
-----

The other tool-button named "Window" has the same problem. I shows names 
of all opened application windows, but the app-icon never appear even 
the icon (18x18) is available.

Please tune me on the right track!

Most kindly
  Moma Antero
  Grønland
  http://www.futuredesktop.org (.com)


_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to