Sunday, April 28, 2024
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 11423  / 3 Years ago, mon, may 31, 2021, 3:49:40

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?


More From » application-development

 Answers
2

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.


[#37347] Wednesday, June 2, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
thellfi

Total Points: 222
Total Questions: 103
Total Answers: 123

Location: Palau
Member since Mon, Aug 16, 2021
3 Years ago
thellfi questions
;