Example
extern crate gtk;
use gtk::prelude::*;
use gtk::{Window, WindowType, Label, Entry, Box as GtkBox, Orientation};
fn main() {
if gtk::init().is_err() {
println!("Failed to initialize GTK.");
return;
}
let window = Window::new(WindowType::Toplevel);
window.connect_delete_event(|_,_| {gtk::main_quit(); Inhibit(false) });
window.set_title("Stackoverflow. example");
window.set_default_size(350, 70);
let label = Label::new(Some("Some text"));
// Create a VBox with 10px spacing
let bx = GtkBox::new(Orientation::Vertical, 10);
let entry = Entry::new();
// Connect "activate" signal to anonymous function
// that takes GtkEntry as an argument and prints it's text
entry.connect_activate(|x| println!("{}",x.get_text().unwrap()));
// Add our label and entry to the box
// Do not expand or fill, zero padding
bx.pack_start(&label, false, false, 0);
bx.pack_start(&entry, false, false, 0);
window.add(&bx);
window.show_all();
gtk::main();
}