Small correction. GTK pre-dates GNOME, and originally stood for "GIMP Toolkit", since it was a widget toolkit created for use by The GIMP project. GIMP stands for "GNU Image Manipulation Program", so technically speaking, the "G" in GTK, stands for "GNU" (where the "G" stands for nothing but itself). However, today GTK doesn't actually stand for anything. It is no longer an acronym.
Just an FYI, you don't need the "move" in "move |_|...." There aren't variables to capture in this case to force it into a closure. So you can just use |_| without move. I'm still learning Rust so correct me if my description is wrong or doesn't make sense! Thanks!
2 года назад+14
Wonderful tutorial! Amazing how much you were able to cover in such a short time span. Very efficient and straight to the point :) I hope you make more tutorials!
Excellent video. Gives me my next steps. I had fumbled about the 'net trying to figure this out on my own, and got part way there. Mine is a bit simpler, but probably going in the wrong direction: use gtk::prelude::*; use gtk::{Button, Window, WindowType}; use std::process; fn main() { gtk::init().expect("Failure initializing GTK."); let window = Window::new(WindowType::Toplevel); let button = Button::with_label("Click Me to Exit"); button.connect_clicked(move |_| { process::exit(1); }); window.add(&button); window.show_all(); gtk::main(); }
Amazing clear and calming voice, works great to watch the tutorial before going to bed. Tomorrow will definitely try to build my first app with GTK, sounds like an easy functional kit
Hi there. Your video made me curious about GTK and Rust, so I tried it myself and playing with it I wonder if it would be possible to create multiple threads aside of the GTK-GUI where the Labels and Buttons interact with each other but also with threads outside the GTK-Application to share data in-between. Getting warm with Rust is a little pain in the a**, since the type-safety of Rust is giving a very hard time. As a little experiment I would like to take an Arduino with some sensors and would like to send UDP-packets over WiFi to my PC where a little Rust-Programm with a GTK-GUI displays temperature, pressure, humidity, etc. ... Do you have experience in these kind of architectures?
So I don't have much experience with Arduino, however I'm very familiar with threaded programming and Raspberry PIs. I'll look into this sort of thing for future videos.
I can't stand to go back to the ancient mess pattern of mixing ui and state and rebuilding the app and redoing every step every time I change something. Not when toolkits in other languages provide things like stateful hot reload, proper state management and having UI as a function of state. I hope rust gets a proper, modern UI Framework soon.
I got a really stupid question... How on earth do you get a more complicated GTK app to build? No matter how many "devel" packages I've tried on Fedora and OpenSUSE, my projects will never build unless it's Gtk3 instead of Gtk4.
No such thing as a stupid question. How complex are we talking? I believe in the gtk-rs book it says you need to build with meson for the more complex applications. Usually the build errors have some handy insight into what's not working.
Analyze the output of cargo's build process, and see which dependency it fails on. If it's failing on gtk4, then the package you need (at least on Fedora) is "gtk4-devel". If you're using libadwaita as well, and fails while building that dependency, you'll want to install "libadwaita-devel". That should be everything. If that doesn't work, come back here, and feel free to post the offending part of the `cargo build` output. It should give us a better idea of what else could be wrong.
To my knowledge, for something simple like this no. Idk what theme you use but it shouldn't be too hard to add gtk4 support. It's apps that are written with the libadwaita libraries that won't support theming.
Hey, i got an error at the state at 7:00: when i run "cargo run", it opens a console with: (app.exe:17036): Gsk-CRITICAL **: 12:59:41.536: Failed to load shader program: Compilation failure in shader. Source Code: 1| #version 440 2| #define N_TEXTURES 16 3| #define N_EXTERNAL_TEXTURES 0 4| #define GSK_VERTEX_SHADER 1 5| #define GSK_VARIATION 2u 6| #define GSK_SHADER_CLIP GSK_GPU_SHADER_CLIP_NONE 7| #ifndef _COMMON_ 8| #define _COMMON_ and 2000 more code line appears in the console Do you khnow how i can fix this shader error?
i got the same error but it went away when i replaced "use gkt::gio::Application;" with "use::Application;" im not sure why the rust analyzer automatically defaults to using gtk::gio::Application but it doesnt work if that still doesnt work then idk whats wrong with it
The best tutorial to implement Rust and Gtk together on the first step to go with.
Small correction. GTK pre-dates GNOME, and originally stood for "GIMP Toolkit", since it was a widget toolkit created for use by The GIMP project. GIMP stands for "GNU Image Manipulation Program", so technically speaking, the "G" in GTK, stands for "GNU" (where the "G" stands for nothing but itself). However, today GTK doesn't actually stand for anything. It is no longer an acronym.
Gnu is an animal name
@@ruben6295 GNU in this case stands for "GNU's not Unix!" so root is correct that it stands for itself
Just an FYI, you don't need the "move" in "move |_|...."
There aren't variables to capture in this case to force it into a closure. So you can just use |_| without move.
I'm still learning Rust so correct me if my description is wrong or doesn't make sense! Thanks!
Wonderful tutorial! Amazing how much you were able to cover in such a short time span. Very efficient and straight to the point :) I hope you make more tutorials!
Great tutorial! I was thinking that doing GUI in Rust must be hard but you managed to disprove it in mere 16 minutes. Thanks!
You are literally the best, I've been looking for a tutorial for three days and yours works
Excellent video. Gives me my next steps. I had fumbled about the 'net trying to figure this out on my own, and got part way there. Mine is a bit simpler, but probably going in the wrong direction:
use gtk::prelude::*;
use gtk::{Button, Window, WindowType};
use std::process;
fn main() {
gtk::init().expect("Failure initializing GTK.");
let window = Window::new(WindowType::Toplevel);
let button = Button::with_label("Click Me to Exit");
button.connect_clicked(move |_| { process::exit(1); });
window.add(&button);
window.show_all();
gtk::main();
}
This is nice. You've put me on a whole new level of learning rust. Looking forward to more rust content on this channel. THANKS
Amazing clear and calming voice, works great to watch the tutorial before going to bed. Tomorrow will definitely try to build my first app with GTK, sounds like an easy functional kit
What a legend only one ad in the beginning . Your so damn underrated
Would love an expansion to this with libadwaita. Going through the tutorials and I'm struggling to make an idiomatic Gnome-themed app
Nice! I like to see more of such hands-on tutorials!
That looks much better now than the last time I tried
Thank you! Nice introduction to a simple UI giving me motivation to give it a try myself.
Good example. Exactly what I needed.
This is actually good man. thanks for the video.
5:38 🐈
soft just keeps getting better
Thank's a lot bro !!
ITS WORKING! nice job dude
Great video. Thank you for all. Can you provide more about rust gui?
Hello, fellow small tech RUclipsr!
How the F%%K do you still have less than a 1000 subscribers??? This a great f###king video!!!
good work king, love you
So I am on an Ubuntu desktop which does not have support for GTK4 and append method is from GTK4, what is the GTK3 version of append?
great job, but how to bundle an release executable file and installer ?
Did you get fruity or producer edition? Im looking to buy soft soft but i dont know if Producer edition is worth it...
Hi there. Your video made me curious about GTK and Rust, so I tried it myself and playing with it I wonder if it would be possible to create multiple threads aside of the GTK-GUI where the Labels and Buttons interact with each other but also with threads outside the GTK-Application to share data in-between. Getting warm with Rust is a little pain in the a**, since the type-safety of Rust is giving a very hard time. As a little experiment I would like to take an Arduino with some sensors and would like to send UDP-packets over WiFi to my PC where a little Rust-Programm with a GTK-GUI displays temperature, pressure, humidity, etc. ... Do you have experience in these kind of architectures?
So I don't have much experience with Arduino, however I'm very familiar with threaded programming and Raspberry PIs. I'll look into this sort of thing for future videos.
@@jakewestall5201 I'm looking forward to it :D
That was great. Thank you.
I can't stand to go back to the ancient mess pattern of mixing ui and state and rebuilding the app and redoing every step every time I change something. Not when toolkits in other languages provide things like stateful hot reload, proper state management and having UI as a function of state.
I hope rust gets a proper, modern UI Framework soon.
interesting video I like it. btw. your "My rust tutorial part " links are broken can you pls fix?
Should be fixed now. Moved blogging platforms and forgot to update those links. Thanks for the reminder
@@jakewestall5201 works now thanks! and part 3 Yes please :)
like What are the basics you need to learn to produce a , or setup it. Also I need to learn how to add soft notes to a .
how are you writing rust without lsp??
what linux distro are you using now??
Pop!_OS
Thank you for this! Super cool video! A+++
I got a really stupid question... How on earth do you get a more complicated GTK app to build? No matter how many "devel" packages I've tried on Fedora and OpenSUSE, my projects will never build unless it's Gtk3 instead of Gtk4.
No such thing as a stupid question. How complex are we talking? I believe in the gtk-rs book it says you need to build with meson for the more complex applications. Usually the build errors have some handy insight into what's not working.
Analyze the output of cargo's build process, and see which dependency it fails on. If it's failing on gtk4, then the package you need (at least on Fedora) is "gtk4-devel". If you're using libadwaita as well, and fails while building that dependency, you'll want to install "libadwaita-devel". That should be everything. If that doesn't work, come back here, and feel free to post the offending part of the `cargo build` output. It should give us a better idea of what else could be wrong.
Cool video, but it's gtk4 and my desktop theme does not support gtk4 so it's a deal-breaker for me bruh. Is it harder to make gtk3 app?
To my knowledge, for something simple like this no. Idk what theme you use but it shouldn't be too hard to add gtk4 support. It's apps that are written with the libadwaita libraries that won't support theming.
it takes at least 30 seconds for me to compile a demo project what only took you a second basically.
boa!!!! 🇧🇷🇧🇷🇧🇷
How? Could you please give ? It will be very helpfull!
build error on windows...
Rich Evans?
better mic = more subs, good content.
Kali Point
Vern Plain
RedLetterMedia doesn’t pay enough, huh, Rich?
I'm so powerful, I don't need batteries to play
I recommend this crack
This is horrible! I can't believe my eyes! Vim?! EWWWWW!
This post made by EmacsGang. Also good vid tho fr
If I ever make a follow up I'm doing it in VS Code just because of this comment.
no
Hey, i got an error at the state at 7:00:
when i run "cargo run", it opens a console with:
(app.exe:17036): Gsk-CRITICAL **: 12:59:41.536: Failed to load shader program: Compilation failure in shader.
Source Code:
1| #version 440
2| #define N_TEXTURES 16
3| #define N_EXTERNAL_TEXTURES 0
4| #define GSK_VERTEX_SHADER 1
5| #define GSK_VARIATION 2u
6| #define GSK_SHADER_CLIP GSK_GPU_SHADER_CLIP_NONE
7| #ifndef _COMMON_
8| #define _COMMON_
and 2000 more code line appears in the console
Do you khnow how i can fix this shader error?
i got the same error but it went away when i replaced "use gkt::gio::Application;" with "use::Application;"
im not sure why the rust analyzer automatically defaults to using gtk::gio::Application but it doesnt work
if that still doesnt work then idk whats wrong with it