Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Not sure if this is a bug or just a very annoying feature, but I can't get an image to appear on any of my buttons in Glade Designer.

enter image description here enter image description here

Is there some property I need to change in order to force it to display the image?

share|improve this question
up vote 3 down vote accepted

I believe this is because by default (not sure if it's a GNOME-wide or GTK setting), no images are shown in buttons, so I'm not sure there is a way around it, either.

This Stackoverflow question hints at stock images not shown in buttons because of that, which I assume it applies to custom images too.

You might try the workaround mentioned in that question to see if it works for you:

from gi.repository import Gtk

settings = Gtk.Settings.get_default()
settings.props.gtk_button_images = True

What I have also noticed is that toolbar button images are not affected by this setting and are always shown. Simply make sure to prepend ../media to the image path in Glade, as Garry Cairns is mentioning in his answer.

share|improve this answer
This raised the following exception: ImportError: could not import gobject (error was: ImportError('When using gi.repository you must not import static modules like "gobject". Please change all occurrences of "import gobject" to "from gi.repository import GObject".',)) – Sardathrion Aug 15 '12 at 10:06

The steps below should work (from the look of your question you can start at step 5 but I've included all of them for future users).

  1. Make sure the icon image you want to use is in your_app/data/media
  2. select the widget you want to apply the image to in glade
  3. choose icon widget in edit image on the right tool button properties panel to add an image widget to your button
  4. edit the image widget you just created to add an image using the right panel (select file name in edit image and browse to your image
  5. prefix the file name that appears in file name with ../media/ so glade can see it.

You can see a screencast of this process from about 33 minutes onwards in the create your first app video Jono Bacon released.

share|improve this answer
You just described what I did in the first place. – RobinJ Jun 23 '12 at 11:35
Your screenshot doesn't show a relative path in the filename (says fb.ico instead of ../media/fb.ico) as per step 5. Is the screenshot accurate? – Garry Cairns Jun 23 '12 at 11:36
I've tried both. – RobinJ Jun 23 '12 at 11:52
Sorry for long delay. This is interesting. If you try to use a stock icon do they show up or are they missing too? If they're missing then the problem is almost certainly the way you're trying to apply it rather than any settings problem. At a guess I'd say it might happen if you try to add the button directly rather than by right-clicking on the menubar and adding it in the hierarchy - when I tried to do it that way in testing this for you I couldn't get any icons either. Give that a try and let me know how it goes. – Garry Cairns Jun 23 '12 at 22:09
Stock icons do not work either. They only show up when using a toolbar with buttons in it. – RobinJ Jun 23 '12 at 22:24

You could also try to do it using Python if glade doesn't work for you:

 image = Gtk.Image()

 button = self.builder.get_object("yourButton")
share|improve this answer

Everything is correct what you did actually...the file name "fb.ico" is the problem! give the full link there for your image. It will show your image in your glade window when you run a code. you know that :-)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.