I want to insert a button inside another button

I want to insert a button inside another button
But the inside button is not working

    my_btn = Gtk.Button()        
    box = Gtk.Box(spacing=0,orientation=Gtk.Orientation.HORIZONTAL)
    close_img = Gtk.Image.new_from_icon_name("close")
    btn_close = Gtk.Button()
    btn_close.set_child(close_img)
    lab = Gtk.Label()
    lab.set_label(title)
    box.append(lab)
    box.append(btn_close)
    my_btn.set_child(box)

You can’t do that; you’d need to replace the outer button with a different widget with its own click gesture. The technical reason is that GtkButton’s click gesture uses the capture phase, so it receives the event before it gets to its child.

1 Like