i want to build an app which counts work out reps and stuff and have currently made the menu with two buttons ,i want to display the a new page with the press of a button ,how do i hide the current container?(or is there a better way to do it)?
use glib::clone;
use gtk::prelude::*;
use gtk::{Align,Application,ApplicationWindow,Button};
use gtk::{gdk,gio,glib};
fn main() {
let application=gtk::Application::new(
Some("com.githun.gtk-rs"),
Default::default(),
);
application.connect_activate(build_ui);
application.run();
}
fn build_ui(application: &Application){
let window = ApplicationWindow::builder()
.application(application)
.title("Train")
.default_width(350)
.default_height(700)
.build();
let container = gtk::Box::builder()
.orientation(gtk::Orientation::Vertical)
.margin_top(24)
.margin_bottom(24)
.margin_start(24)
.margin_end(24)
.halign(gtk::Align::Center)
.spacing(24)
.build();
let button = Button::builder()
.margin_top(10)
.margin_bottom(10)
.margin_start(10)
.margin_end(10)
.halign(Align::Center)
.valign(Align::Center)
.label("Work out")
.build();
button.connect_clicked(|_|{
println!("hello");
});
container.append(&button);
let button2 = Button::builder()
.margin_top(10)
.margin_bottom(10)
.margin_start(10)
.margin_end(10)
.halign(Align::Center)
.valign(Align::Center)
.label("Workout Builder")
.build();
container.append(&button2);
window.set_child(Some(&container));
window.show();
}