Been using egui for almost 3 years now, it's been great for my desktop app development. Especially considering that the Rust GUI ecosystem is still somewhat in its infancy, this option has been great and enjoys good support from its author.
By the way, instead of needing to add egui as another dependency, eframe re-exports the entirety of egui under eframe::egui. So it's possible to remove egui as a dependency entirely.
Pretty neat! I've been looking for a rust lib for simple UI. Not entirely sold on immediate ui, but for replacing simple cli with button clicks it seems great!
This was really awesome, when I first looked at rust about...idk lets say 4-5 years ago, it was a pain to get simple stuff going, but once I got the simple stuff working, things like GUI was my next target and in almost every langauge GUI is not a simple thing, its more of a process, This video shows that next step and kinda shows how simple it can be...rust being the biggest hurdle instead of the GUI lib itself, Thanks for this video bro.
Great video, I hope there's more to come! In the mean time, I will take this opportunity to learn how to make GUI apps lol. I'm sick of the usual tutorial series though. If you could just share the sort of abridged version of your experience building a project, like the thought process and the hurdles (big & small) and the way you cleared them, that would be super appreciated!
you could use imgui, it may not be the most pretty UI, but it works. And if you want some more control over how it works, you could just make it from scratch like you would with making a normal game with OpenGL or whatever graphics API you prefer, or maybe SDL or Raylib. Though, doing it this way may lead to having some more work than you would usually do, but you get to do it the same way you make games, and you get more control over how it looks.
I've been making GUI apps in Godot with the Rust bindings. There's a project setting to use less CPU (be less game-like by only updating on events rather then rerendering as fast as possible). It's nice to be able to make a VR view of several GUIs, or to be able to just render a 3D model as part of the GUI.
This is my first time seeing your channel, but I've just subscribed in hopes of coming eGui tutorials. I really think eGui is important. A guy opens up tools to a lot of people, and opens up ways of presenting info. But most guis seems focused on helping front-end teams, separate from backend teams. For small, single developer or small team tools, I want a low maintenance logically transparent tool. I think of it as being an evolution of the CLI program. That said, it's more involved than call and I constantly find myself starting and not quite jumping in. (e.g. displaying Polars tables to make interactive data analysis tools -- but there's just ... a lot of little options and it's easy to get side tracked.)). Rerun is also one of those amazing tools (focused on multimodal data presentation) that I'd like to see -- and may have game dev utility, some day. Just to put that out there :)
You know you actually can grab any light open source web browser and just do your GUI with html/canvas API? You don't need to wait for Compose to do the same thing. Goland have quite similar project called Muon. If you can significantly shrink webkit based browser by removing unnecessary modules.
I'm building a multiplatform, multiplayer game and a utility app in Compose Multiplatform. They're both side projects though, so the amount of time I can focus on them is limited. But I'll get there! Android dev is my day job so picking up Compose Multiplatform has been a breeze!
@@asandax6Yes and no. Yes on Android and desktop, no on iOS or JS or WebAssembly. Plus I find that interop generally works much better with Kotlin than it does with Dart.
there are reasons why commercial GUI program using tree based hierarchy and event callbacks, they can be drawn lazily. If no interaction happens no needs to redraw, saving a lot of CPU cycles.
@@dorktales254 didn't know that, I thought it was 1 to 1 ImGUI clone. but, still it has to check all possible branch if event occurred. tree based hierarchy only needs to call the callback specified at the beginning.
If you want to understand why leaving a line without the semicolon isn't a quirk and rather a consequent implementation of how programming languages work, you can read up on the difference between a statement and an expression. And then you can look up what Rust defines as such. Once you get a grasp of those fundamental concepts you will have a lot more fun programming in general.
Making GUI apps is something I want to get into as well. I really would love for something to be as easy to style as Electron is thanks to relying on CSS... but for native desktop apps. QT honestly looks like a pain to work in (just from a glance) and doesn't even look good. Will probably explore Flutter for that!
"I tried Electron but I don't like writing JavaScript, and the bundle size is too large" Well why not use Tauri then? Since you already write Rust, and its bundle size is so small? I never used Tauri though, just a thought...
I've used Iced to build a gui app with Rust earlier this year but haven't gotten around to egui yet. Does anyone have experience with both and some insight into which they prefer?
Rust code looks like someone who watched too many python tutorials on YT created their own language with the best intentions. But stuff like returning when no semi colon is uh ... it has that "look at me, I'm so quirky!"-vibe to it. Don't get me wrong, I like Rust. Comprehensive error codes should be default in any language but apparently ferrous oxide can do that. But I also like readable code. Constructing a constructor in a constructor in a function call (and for some reason taking the absolute value of that) while adding ascii code smiley faces to parameters ... maybe readable for an n-th degree Rust wizard. But not for a human.
Rust is an expression based language, like the functional languages it takes inspiration from. That means that each and every single line of code that ends in a semicolon returns `()`, which is the unit type. Therefore, you only need to remove said semicolon to return the evaluation of the current expression. It's not a thing done only to be quirky, it's a consequence of the design decisions taken when making the language. I completely understand you don't like it and that's fair. But language syntax is not really that important once you get familiarized enough, it all goes away with practice
@@ghostsdefeated4078 Yeah, there is. If you look at something like Ocaml, you'll recognize Rust's DNA everywhere. It's in things like it's algebraic data types, that gives you the Option and Result types, pattern matching, inmutable data by default, tail call optimizations, etc. There's a lot of expressivity in functional languages that has no real equivalent in procedural or oop
Just curious with not using Monogame and Imgui? That's what I use for immediate mode GUI apps and it's honestly really easy to work with! I loved working with Rust in the past when learning bevy but Rust is always kinda scary
Rust is very scary I will say. There are some issues I have with imgui that aren't really its fault that led me to choose egui over it. I still use imgui in my own projects for debugging though! Also, i didnt know about hello_imgui, where you can make standalone imgui apps. Thats definitely something to check out if you dont want to work with rust
That can be quite a bit of work before getting an actual app running. I love raylib and SDL2, but writing a UI library from is very tedious. Raygui is pretty cool tho. I still prefer something like ImGui or egui.
@@codingwithsphereit's a lot less work than learning Rust and fight with a compiler. After all C++ is kinda gamedev standard along side with C# that also have access to it. I kinda liked rust in a past, but in reality "Rust safety" is smaller variety than just "safety", you can write absolutely memory safe program that just don't have viable implementation in Rust. And also it's hard to create interesting program without unsafe Rust. Also i fall in love with "Textual" Python gui that is kinda CLI inspired. And you can use it for rapid app development and prototyping. And it kinda opened my eyes on GUI development, because it's so fast and easy, it's kinda a scaffolding development, you have so little personal value over things that you already implemented that you have almost zero cost for refactoring, removing and implementing new features in constant iteration. It's kinda like a creating a new way of thinking over process, and Rust will be hard.
Egui is not a clone. It doesn't use bindings to imgui, its written in pure rust. There are however bindings for imgui available under a different library.
Coming from the Python world, I can say this is way too complicated for a "simple" app, if you want simple a "desktop apps" use something like Tkinter and make the same App in less than 15mins (You can create the critical parts in Rust using Pyo3 like the image conversion logic if you wish). IMHO using high level programming languages for UI programming is the way to go, you reduce the development time and complexity of the code by a lot, and you still can optimize the critical parts using low-level languages like Rust, C, ... etc. You can use any high-level programming language and framework you want, as long as it is fast to develop, cross-platform and allows for easy low-level language interfacing.
Yes, I have to say that Tkinter was on my mind the whole time I was watching the video, although I understand that he didn't want to relate to QT. I used CustomTkinter, btw. Maybe I'll try Flet next time.
You can run the same code for ui using different runtimes, or even just crosscompile it. Excluding mobile platforms of course(but theoretically this is possible). So it's totally cross-platform
It does though. Docs: "eframe is the official egui framework, which supports writing apps for Web, Linux, Mac, Windows, and Android." github.com/emilk/egui
@@codingwithsphere Webapps are not crossplatform in the same way that native applications are tho... they rely on the web support for a certain platform, which means that your crossplatform webapp is not going to be even remotely comparable to a truly crossplatform native program. I thought you were aware of that after ditching electron, yet you claim that it has support for "writing apps for web", like bruh, that's not a solution to the problem. Btw, what about IOS? not that I plan to write for IOS, but that's what the comment mentioned and you decided to ignore it and mention that it has Android support, as if all mobile platforms were Android. Is Androind and Windows all there is to app development these days? I can sort of understand ditching Linux because Linux people are actually sane and prefer using CLI tools over terrible, slow and bloated UI "apps" (I miss the days when we called programs, well, programs), but come on, if we're going to claim to be crossplatform, at least make that claim true lmao. Anyways, as the OP said, classic. I'll be going back to C, where a bunch of ifdefs actually give me true crossplatform code that I can easily abstract through macros. Enjoy your almost crossplatform framework that relies on a web backend when there is no valid target (as per the description given in the github repo you linked yourself). Also, you seem to be confusing the difference between egui and eframe... they actually explain this in the repo you linked (quite ironic to link something that you yourself have not read through, and to top it all off, make a video about it without actually knowing what any of what you're using is or does)... "What is the difference between egui and eframe? egui is a 2D user interface library for laying out and interacting with buttons, sliders, etc. egui has no idea if it is running on the web or natively, and does not know how to collect input or show things on screen. That is the job of the integration or backend."
Been using egui for almost 3 years now, it's been great for my desktop app development. Especially considering that the Rust GUI ecosystem is still somewhat in its infancy, this option has been great and enjoys good support from its author.
By the way, instead of needing to add egui as another dependency, eframe re-exports the entirety of egui under eframe::egui. So it's possible to remove egui as a dependency entirely.
Pretty neat! I've been looking for a rust lib for simple UI. Not entirely sold on immediate ui, but for replacing simple cli with button clicks it seems great!
This was really awesome, when I first looked at rust about...idk lets say 4-5 years ago, it was a pain to get simple stuff going, but once I got the simple stuff working, things like GUI was my next target and in almost every langauge GUI is not a simple thing, its more of a process, This video shows that next step and kinda shows how simple it can be...rust being the biggest hurdle instead of the GUI lib itself, Thanks for this video bro.
Great video, I hope there's more to come! In the mean time, I will take this opportunity to learn how to make GUI apps lol.
I'm sick of the usual tutorial series though.
If you could just share the sort of abridged version of your experience building a project, like the thought process and the hurdles (big & small) and the way you cleared them, that would be super appreciated!
you could use imgui, it may not be the most pretty UI, but it works.
And if you want some more control over how it works, you could just make it from scratch like you would with making a normal game with OpenGL or whatever graphics API you prefer, or maybe SDL or Raylib. Though, doing it this way may lead to having some more work than you would usually do, but you get to do it the same way you make games, and you get more control over how it looks.
ImGui and egui are both highly customizable. I don't think the appearance is an issue for most people tbh.
Very nice!
I'm gonna consider this for planning my game
I've been making GUI apps in Godot with the Rust bindings. There's a project setting to use less CPU (be less game-like by only updating on events rather then rerendering as fast as possible). It's nice to be able to make a VR view of several GUIs, or to be able to just render a 3D model as part of the GUI.
This is my first time seeing your channel, but I've just subscribed in hopes of coming eGui tutorials. I really think eGui is important. A guy opens up tools to a lot of people, and opens up ways of presenting info. But most guis seems focused on helping front-end teams, separate from backend teams. For small, single developer or small team tools, I want a low maintenance logically transparent tool. I think of it as being an evolution of the CLI program. That said, it's more involved than call and I constantly find myself starting and not quite jumping in. (e.g. displaying Polars tables to make interactive data analysis tools -- but there's just ... a lot of little options and it's easy to get side tracked.)). Rerun is also one of those amazing tools (focused on multimodal data presentation) that I'd like to see -- and may have game dev utility, some day. Just to put that out there :)
Kotlin Compose Multiplatform will be perfect for this once it gets stable 🙏
You know you actually can grab any light open source web browser and just do your GUI with html/canvas API? You don't need to wait for Compose to do the same thing. Goland have quite similar project called Muon. If you can significantly shrink webkit based browser by removing unnecessary modules.
I've never heard of this until now. I'll check it out!
I'm building a multiplatform, multiplayer game and a utility app in Compose Multiplatform. They're both side projects though, so the amount of time I can focus on them is limited. But I'll get there!
Android dev is my day job so picking up Compose Multiplatform has been a breeze!
Ahh yes Flutter for the JVM
@@asandax6Yes and no. Yes on Android and desktop, no on iOS or JS or WebAssembly. Plus I find that interop generally works much better with Kotlin than it does with Dart.
great video bro , and yes we need more videos about egui and rust make it a series
there are reasons why commercial GUI program using tree based hierarchy and event callbacks, they can be drawn lazily. If no interaction happens no needs to redraw, saving a lot of CPU cycles.
tbf egui also has a lazy rendering model
@@dorktales254 didn't know that, I thought it was 1 to 1 ImGUI clone. but, still it has to check all possible branch if event occurred. tree based hierarchy only needs to call the callback specified at the beginning.
If you want to understand why leaving a line without the semicolon isn't a quirk and rather a consequent implementation of how programming languages work,
you can read up on the difference between a statement and an expression.
And then you can look up what Rust defines as such.
Once you get a grasp of those fundamental concepts you will have a lot more fun programming in general.
Will do thanks!
Making GUI apps is something I want to get into as well. I really would love for something to be as easy to style as Electron is thanks to relying on CSS... but for native desktop apps. QT honestly looks like a pain to work in (just from a glance) and doesn't even look good. Will probably explore Flutter for that!
I click on a random video and it goes into egui, something I am also working on. Coincidences happen so much.
I thought Rust could only be written on vim
And you need blue hair
@@no_name4796 and a split keyboard
@@aimpizza6823 Or a Thinkpad
Sir which vs code theme are you using?
Thx for sharing it
how about slint
I would love a tutorial Series on this.
"e-GUI is an immediate mode UI library written in Rust"
And like that, you've lost me.
Your loss for falling under the trap of "rust sux" bubbles
lol I understand
I'm not a fan of Rust and immediate mode GUIs (aside from quick tools), but this was still somewhat interesting to watch
"I tried Electron but I don't like writing JavaScript, and the bundle size is too large"
Well why not use Tauri then? Since you already write Rust, and its bundle size is so small?
I never used Tauri though, just a thought...
cargo add --features
Immediate mode GUI's are fine until you decide to use more advanced layouts, like flex box or grid.
This is true. I wouldn't use it for the front page of a website. However, there are some great examples of cool layouts in the egui community.
petition for making sphere to continue the opentk minecraft tutorials, maybe think of making series for glsl, Thanks for the amazing tutorials though❤
0:25 - have you tried FLTK?
I haven't yet
it looks like shit
Thanks bro
have you tried Flutter?
Not yet but soon
I've used Iced to build a gui app with Rust earlier this year but haven't gotten around to egui yet. Does anyone have experience with both and some insight into which they prefer?
Great vid brother, Can you do a VSCode setup to have one similar to yours ?
Good idea
Name your Visual Studio Code theme!
Sequoia Moonlight
Rust code looks like someone who watched too many python tutorials on YT created their own language with the best intentions.
But stuff like returning when no semi colon is uh ... it has that "look at me, I'm so quirky!"-vibe to it.
Don't get me wrong, I like Rust. Comprehensive error codes should be default in any language but apparently ferrous oxide can do that. But I also like readable code. Constructing a constructor in a constructor in a function call (and for some reason taking the absolute value of that) while adding ascii code smiley faces to parameters ... maybe readable for an n-th degree Rust wizard. But not for a human.
agreed
I agree with the no semicolon return. I really dont like it
Rust is an expression based language, like the functional languages it takes inspiration from. That means that each and every single line of code that ends in a semicolon returns `()`, which is the unit type. Therefore, you only need to remove said semicolon to return the evaluation of the current expression. It's not a thing done only to be quirky, it's a consequence of the design decisions taken when making the language. I completely understand you don't like it and that's fair. But language syntax is not really that important once you get familiarized enough, it all goes away with practice
@@daliareds is there any use to this inspiration from functional languages?
@@ghostsdefeated4078 Yeah, there is. If you look at something like Ocaml, you'll recognize Rust's DNA everywhere. It's in things like it's algebraic data types, that gives you the Option and Result types, pattern matching, inmutable data by default, tail call optimizations, etc. There's a lot of expressivity in functional languages that has no real equivalent in procedural or oop
I see a lot of tools being made with godot, maybe try that too if you find the time some day.
Something similar written in C is nuklear.
Just curious with not using Monogame and Imgui? That's what I use for immediate mode GUI apps and it's honestly really easy to work with! I loved working with Rust in the past when learning bevy but Rust is always kinda scary
Rust is very scary I will say. There are some issues I have with imgui that aren't really its fault that led me to choose egui over it. I still use imgui in my own projects for debugging though! Also, i didnt know about hello_imgui, where you can make standalone imgui apps. Thats definitely something to check out if you dont want to work with rust
Tauri is very good :>
(but its HTML, CSS, JS in frontend Rust in backend)
Cargo run:
Vroooooom
Gosh why is this so difficult to read?
what about dear imgui
Imgui is great
Why not just write your GUI in raylib or sdl?
That can be quite a bit of work before getting an actual app running. I love raylib and SDL2, but writing a UI library from is very tedious. Raygui is pretty cool tho. I still prefer something like ImGui or egui.
@@codingwithsphereit's a lot less work than learning Rust and fight with a compiler. After all C++ is kinda gamedev standard along side with C# that also have access to it. I kinda liked rust in a past, but in reality "Rust safety" is smaller variety than just "safety", you can write absolutely memory safe program that just don't have viable implementation in Rust. And also it's hard to create interesting program without unsafe Rust.
Also i fall in love with "Textual" Python gui that is kinda CLI inspired. And you can use it for rapid app development and prototyping. And it kinda opened my eyes on GUI development, because it's so fast and easy, it's kinda a scaffolding development, you have so little personal value over things that you already implemented that you have almost zero cost for refactoring, removing and implementing new features in constant iteration. It's kinda like a creating a new way of thinking over process, and Rust will be hard.
Obligatory did u try Rust? Rewrite it in Rust.
no waaay a media converter. i made a cli tool for that with python.
good job !
egui is a "clone" of "imgui", not sure why you can't just use "imgui" which is C library.
The one is a C library meant for C / CPP. The other is rust native made specifically for rust using special rust features
I made this on egui because I enjoyed my experience making standalone applications with it more than I did with imgui.
Egui is not a clone. It doesn't use bindings to imgui, its written in pure rust. There are however bindings for imgui available under a different library.
egui has nothing to do with imgui aside from being immediate mode
You can’t use it if you are developing using, e.g, Bevy, which is a Rust framework for gamedev.
Wxwidgets?
Funny enough the easiest way for a game developer to make a UI app might be... Godot
Aren't godot build sizes still a little bit too high for a small app? (Never tried godot)
Coming from the Python world, I can say this is way too complicated for a "simple" app, if you want simple a "desktop apps" use something like Tkinter and make the same App in less than 15mins (You can create the critical parts in Rust using Pyo3 like the image conversion logic if you wish).
IMHO using high level programming languages for UI programming is the way to go, you reduce the development time and complexity of the code by a lot, and you still can optimize the critical parts using low-level languages like Rust, C, ... etc.
You can use any high-level programming language and framework you want, as long as it is fast to develop, cross-platform and allows for easy low-level language interfacing.
Yes, I have to say that Tkinter was on my mind the whole time I was watching the video, although I understand that he didn't want to relate to QT.
I used CustomTkinter, btw. Maybe I'll try Flet next time.
You can also opt for Tauri or Wails and avoid Python where it shouldn't be used.
I have written a couple little apps with custom tkinter. I really enjoy it! I still prefer using immediate mode libraries, but I use both.
@@theyioel Flet is great
depends on task and acceptable complexity level, most of the time there is no reason to bloat app architecture
*PromoSM*
Oh it's cross platform, so it runs on ios, android, linux, mac and windows ? No? oh so it's not cross platform. Classic
Take a look at Tauri, with the V2 it's going to be very interesting even if still not perfect.
You can run the same code for ui using different runtimes, or even just crosscompile it. Excluding mobile platforms of course(but theoretically this is possible). So it's totally cross-platform
It does though. Docs: "eframe is the official egui framework, which supports writing apps for Web, Linux, Mac, Windows, and Android." github.com/emilk/egui
@@hermes6910 Tauri is awesome
@@codingwithsphere Webapps are not crossplatform in the same way that native applications are tho... they rely on the web support for a certain platform, which means that your crossplatform webapp is not going to be even remotely comparable to a truly crossplatform native program. I thought you were aware of that after ditching electron, yet you claim that it has support for "writing apps for web", like bruh, that's not a solution to the problem.
Btw, what about IOS? not that I plan to write for IOS, but that's what the comment mentioned and you decided to ignore it and mention that it has Android support, as if all mobile platforms were Android. Is Androind and Windows all there is to app development these days? I can sort of understand ditching Linux because Linux people are actually sane and prefer using CLI tools over terrible, slow and bloated UI "apps" (I miss the days when we called programs, well, programs), but come on, if we're going to claim to be crossplatform, at least make that claim true lmao.
Anyways, as the OP said, classic.
I'll be going back to C, where a bunch of ifdefs actually give me true crossplatform code that I can easily abstract through macros. Enjoy your almost crossplatform framework that relies on a web backend when there is no valid target (as per the description given in the github repo you linked yourself).
Also, you seem to be confusing the difference between egui and eframe... they actually explain this in the repo you linked (quite ironic to link something that you yourself have not read through, and to top it all off, make a video about it without actually knowing what any of what you're using is or does)...
"What is the difference between egui and eframe?
egui is a 2D user interface library for laying out and interacting with buttons, sliders, etc. egui has no idea if it is running on the web or natively, and does not know how to collect input or show things on screen. That is the job of the integration or backend."