Using

Prepare your system: Requirements

Include gtk and gio in your Cargo.toml and set the minimal GTK version required by your project:

[dependencies.gtk]
version = "0.7.0"
features = ["v3_16"]

[dependencies.gio]
version = ""
features = ["v2_44"]

The APIs aren’t stable yet. Watch the Announcements box above for breaking changes to the crates!

Import the gtk and gio crates and their traits:

extern crate gtk;
extern crate gio;

use gtk::prelude::*;
use gio::prelude::*;

Create an application, etc.

use gtk::{Application, ApplicationWindow, Button};

fn main() {
    let application = Application::new("com.github.gtk-rs.examples.basic", Default::default())
        .expect("failed to initialize GTK application");

    application.connect_activate(|app| {
        let window = ApplicationWindow::new(app);
        window.set_title("First GTK+ Program");
        window.set_default_size(350, 70);

        let button = Button::new_with_label("Click me!");
        button.connect_clicked(|_| {
            println!("Clicked!");
        });
        window.add(&button);

        window.show_all();
    });

    application.run(&[]);
}

Using latest, not published version

Include gtk in your Cargo.toml not as crate but from git:

[dependencies.gtk]
git = "https://github.com/gtk-rs/gtk"
features = ["v3_16"]

Projects using gtk-rs

If you want yours to be added to this list, please create a Pull Request for it!