0

I'm using glade to design a GUI and then loading it with rust and using the gtk-rs library.

When I use the connect_clicked function on a gtk::Button it does nothing when I click the button.

I know that the button is there because I can see it in the window and builder.object() didn't return None. I made sure that the widget id's I used are matching as well.

let builder = gtk::Builder::from_string(include_str!("ui.glade"));
let button = builder.object::<gtk::Button>("button").unwrap();

button.connect_clicked(|_| {
    println!("click");
    // stuff
});

Click never gets printed. I don't know if there is anything else I should mention so please feel free to comment and ask for any details.

  • I have this exact code and it works for me, so I guess that the problem is elsewhere. Maybe you are creating two separate `builder` objects? Connect the signal in one, show the other one on the display? – rodrigo Jun 26 '23 at 07:26

0 Answers0