layout |
---|
wide |
Rust bindings for GTK+ 3, Cairo, GtkSourceView and other GLib-compatible libraries
Crates
{% include badges.html %}Announcements
{% for post in site.categories.front limit:3 %} {{ post.date | date: "%-d %b %Y" }}{{ post.title }}
{% endfor %}Crate | Minimum supported version |
---|---|
atk | 2.30 |
cairo | 1.14 |
gdk | 3.16 |
gdk-pixbuf | 2.32 |
gdk-x11 | 3.14 |
gio | 2.44 |
glib | 2.44 |
gtk | 3.16 |
pango | 1.38 |
pangocairo | 1.0 |
sourceview | 3.0 |
First, prepare your system by taking a look at the GTK installation page.
Then include gtk
and gio
in your Cargo.toml
and set the minimal GTK version required by your project:
{% assign gtk = site.data.crates | where: "name", "gtk" %}
[dependencies.gtk]
version = "{{ gtk[0].max_version }}"
features = ["v3_16"]
[dependencies.gio]
version = "{{ gio[0].max_version }}"
features = ["v2_44"]
The code is stable and feature complete, but the APIs might change in the future.
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(
Some("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::with_label("Click me!");
button.connect_clicked(|_| {
println!("Clicked!");
});
window.add(&button);
window.show_all();
});
application.run(&[]);
}
Include gtk
in your Cargo.toml
not as crate but from git:
[dependencies.gtk]
git = "https://github.com/gtk-rs/gtk"
features = ["v3_16"]
- Banner Viewer
- BrewStillery
- Cigale
- color_blinder_gtk
- Contrast
- Czkawka
- Epicwar Downloader
- Font Finder
- Fractal
- Garta
- Gattii
- GNvim
- gled
- glide
- gpsami
- gtktranslate
- Icon Library
- Iridium
- lognplot
- Marmoset
- mcmmtk
- media-toc
- neovim-gtk
- noaa-apt
- pcatk
- Pika Backup
- PNMixer-rs
- Podcasts
- Popsicle
- process-viewer
- Projectpad
- relm
- rrun
- Shortwave
- Social
- SolidOak
- systemd-manager
- Tau
- tv-renamer
- Whatschanging
If you want yours to be added to this list, please create a Pull Request for it!