Multiple images in a Gtk::Image

Hi,

right now I can use an image like so:

image = Gtk::Image.new(location)
image.set_padding(4,0) # left-right axis, top-down axis
self.set_image(image)

And right next of that image I can display text (both is part of a
button).

Is there a way to set multiple images easily too?
For example I would like to set multiple, little icons of “monsters”
right before the text appears, and I want the whole “line” to behave
like
a button.

Sorry, i forgot to mention - i was speaking about subclassing
a button like so

class ColouredButton < Gtk::Button

And all the Gtk buttons have this ability

self.set_image(image)

I like the idea. It is simple enough, thanks!

Is there a way to set multiple images easily too?
For example I would like to set multiple, little icons of “monsters”
right before the text appears, and I want the whole “line” to behave
like
a button.

A Gtk::Button is also a container, so you can put a Gtk::HBox or a
Gtk::Table inside of it.

Such as:

button = Gtk::Button.new
hbox = Gtk::HBox.new
hbox.pack_start(Gtk::Image.new(…))
hbox.pack_start(Gtk::Image.new(…))
hbox.pack_start(Gtk::Image.new(…))
hbox.pack_start(Gtk::Label.new(‘My button’))
button << hbox
button.show_all

Regards,

André


Lamentação sem gratidão é murmuração. (Howard Hendricks)