Reputation: 3400
I have several hboxes of images contained inside a vbox
How do I make the images clickable?
I tried containing each image inside a EventBox. If this is the right approach, how do I resize the EventBox to the the same size as its image? I tried .set_size_request
but it does not do anything
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
hboxes = []
for f in files:
hbox = gtk.HBox()
hbox.set_size_request(800, 150)
for img in images:
event_box = gtk.EventBox()
event_box.add(img)
event_box.connect("button_press_event", hello)
event_box.set_size_request(250, 150)
hbox.pack_end(event_box, padding=10, fill=False, expand=False)
hboxes.append(hbox)
Upvotes: 0
Views: 610
Reputation: 879
You could try using an iconview instead of the nested vboxes and hboxes. An example can be found here: https://stackoverflow.com/a/3606867/217994
Upvotes: 1