Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1958542
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T08:20:42+00:00 2026-05-17T08:20:42+00:00

I am trying to get an image to appear next to a menu item

  • 0

I am trying to get an image to appear next to a menu item but it isn’t working.

In order to make this as simple as possible, I have created a very simple example below that highlights the problem:

import pygtk
pygtk.require('2.0')
import gtk

class MenuExample:

    def __init__(self):

        window = gtk.Window()
        window.set_size_request(200, 100)
        window.connect("delete_event", lambda w,e: gtk.main_quit())

        menu = gtk.Menu()

        menu_item = gtk.ImageMenuItem("Refresh")

        img = gtk.image_new_from_stock(gtk.STOCK_REFRESH, gtk.ICON_SIZE_MENU)
        img.show()
        menu_item.set_image(img)

        menu.append(menu_item)

        menu_item.show()

        root_menu = gtk.MenuItem("File")

        root_menu.show()
        root_menu.set_submenu(menu)

        vbox = gtk.VBox(False, 0)
        window.add(vbox)
        vbox.show()

        menu_bar = gtk.MenuBar()
        vbox.pack_start(menu_bar, False, False, 2)
        menu_bar.show()

        menu_bar.append(root_menu)

        window.show()

def main():
    gtk.main()
    return 0

if __name__ == "__main__":
    MenuExample()
    main()

When I run the application, it shows the menu item, but it does not show the image next to it.

OS: Ubuntu 10.04 64-bit
Python version: 2.6.5

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T08:20:44+00:00Added an answer on May 17, 2026 at 8:20 am

    Hmmm… it turns out the answer was that my desktop theme had disabled icons for menus. (Who knows why.)

    After enabling the option, the icons now show up.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying to get an Gtk2::Image object in this Perl Gtk2 application to
I am trying to get the background image of my content to appear behind
I am having difficulty trying to get a very simple scenario working with PRISM
I am trying to change the background color and make an image appear on
I'm trying to get a simple file upload working using jquery-fileupload-rails carrierwave fog I
So I'm trying to get an image to appear at a specific point. I've
I'm trying to get an div with image background to appear to the right
I'm trying to make an image appear when you roll over text on the
Im trying to get an image from a wcf rest service like so: [ServiceContract]
I'm trying to get an image sitting at a URL that is protected by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.