Live data from Hacker News

GUI development with Rust and GTK 4

gtk-rs.org

71–80 of 172 posts

Re: GUI development with Rust and GTK 4

#71
post #9

Rust GTK4 "hello world" app, as a downloadable project, demonstrating the builder pattern: https://github.com/SixArm/rust-guideposts/blob/main/projects...

Honestly this looks like programming style from 90s. Why not design UIs in an editor that saves layout to XML?

xml is dated and gross

Re: GUI development with Rust and GTK 4

#72
post #4

AFAIK, for better or worse, this is the only UI crate (other than HTML-like UI using something like Tauri) that provides a full set of widgets/capabilities on Rust. Every other UI lib is incomplete in some way or falls short for anything other than a toy or specialty type app in my experience. UPDATE: Things I have my eye on as they mature: Slint, egui, and iced. I'm especially watching iced as Pop_os is using it for…

I would add the following to your list: - Vizia https://github.com/vizia/vizia - Freya https://github.com/marc2332/freya - Xilem https://github.com/linebender/xilem - Floem https://github.com/lapce/floem

Do any of them have something remotely close to Gtk or Qt's Grid/TreeView widgets? That's the one thing that pretty much 99% of the software I've worked on have needed at some point

Re: GUI development with Rust and GTK 4

#73
post #59
post #40

Earlier quoted context omitted.

I still find it quite sad that the pinnacle of GUI programming tools was reached over 20 years ago, when Delphi 6 was released, and we've been going more or less downhill ever since.

I see it differently: UI needs have gotten more complex. Like how we used to have web sites that said "best viewed in 800x600 in Netscape Navigator" we rarely design one size fits all UIs any more like we did in Delphi.

There's nothing in "modern" UI that cannot be done with Lazarus GUI Builder: Dynamic layouts? check, anchors? check, flexbox? check, custom components? check nested hierarchies of elements? HIDPI? check Vector Graphics? check Multiresolution? check and so on. All of them compiled to native (and looking native) on every platform under the sun. As said before, GUI design peaked in the 90's

Re: GUI development with Rust and GTK 4

#74
post #71

Earlier quoted context omitted.

Honestly this looks like programming style from 90s. Why not design UIs in an editor that saves layout to XML?

xml is dated and gross

I really like XML a lot; I've gotten large numbers of people to use XML & XSLT, where I work. XML is dated, and it is gross. Here's the two things the XML ecosystem nailed, which tie me to it:

1. A dedicated tree-based transformation language (XSL); and,

2. Axis-queries (Xpath).

If I could Xpath all-the-things, I'd be a happier human. Although, I also feel like I should be able to SQL all-the-things, too. Maybe I'm just a sucker for structured-data query-languages?

Re: GUI development with Rust and GTK 4

#75

Earlier quoted context omitted.

I think egui is complete enough to use in real apps. Layout can be a bit weird, but I haven't found anything that's impossible. I might even prefer it for cross-platform apps since startup time is so slow for GTK on Windows.

Agree with egui, although it is missing some widgets, they’re easy enough to build. But the real killer feature for me is that it’s cross platform including the web. Write once and compile to windows/Mac/Linux/web is finally here through Rust and egui.

Qt has supported compilation to web for quite some time now

Re: GUI development with Rust and GTK 4

#76
post #9

Rust GTK4 "hello world" app, as a downloadable project, demonstrating the builder pattern: https://github.com/SixArm/rust-guideposts/blob/main/projects...

Honestly this looks like programming style from 90s. Why not design UIs in an editor that saves layout to XML?

I've never seen the appeal of those "write your UI in a different language than the logic and deal with the interference layer" style of GUI development. But I also think that UI builders tend to produce bad code and ugly layouts when you go beyond CRUD apps that would have been easy to write in the declarative style anyway.

Re: GUI development with Rust and GTK 4

#77
post #57

What about making it easy to import Rust business logic into C# / Swift / whatever GUI language you're using? I get the value of 100% (or 50% or 80%) implementing the UI in Rust; especially for tools that won't benefit from a native UI, or tools that only need light integration into platform-specific UI features. I've also shipped a desktop product that had a 100% native UI and a cross-platform codebase. Today, imple…

That's a good option. It's easy to make a library in Rust that exports a C linkage, and it's easy to link a C library in most languages. Some languages have richer linkages to Rust (for example Python).

A similar option would be to use the native UI with a Rust binding -- for example cacao on MacOS.

The advantage of this approach is if your whole team knows Rust they can help with patching and maintenance. It doesn't help at the beginning because presumably the person who knows AppKit also knows ObjectiveC and/or Swift. But once the UI is created a single code base is an advantage for maintenance.

Re: GUI development with Rust and GTK 4

#78

Earlier quoted context omitted.

Agree with egui, although it is missing some widgets, they’re easy enough to build. But the real killer feature for me is that it’s cross platform including the web. Write once and compile to windows/Mac/Linux/web is finally here through Rust and egui.

Qt has supported compilation to web for quite some time now

And when I tried the examples they posted they were massive & laggy.

Re: GUI development with Rust and GTK 4

#79
post #4

AFAIK, for better or worse, this is the only UI crate (other than HTML-like UI using something like Tauri) that provides a full set of widgets/capabilities on Rust. Every other UI lib is incomplete in some way or falls short for anything other than a toy or specialty type app in my experience. UPDATE: Things I have my eye on as they mature: Slint, egui, and iced. I'm especially watching iced as Pop_os is using it for…

I think egui is complete enough to use in real apps. Layout can be a bit weird, but I haven't found anything that's impossible. I might even prefer it for cross-platform apps since startup time is so slow for GTK on Windows.

I had a quick look and it appears that the Linux backend is GTK-3 based? (Requires gtk-3-dev to build.)

Pity. For a moment I was briefly excited that someone had created a Rust binding for EFL/Enlightenment (aka "E").

Re: GUI development with Rust and GTK 4

#80
post #4

AFAIK, for better or worse, this is the only UI crate (other than HTML-like UI using something like Tauri) that provides a full set of widgets/capabilities on Rust. Every other UI lib is incomplete in some way or falls short for anything other than a toy or specialty type app in my experience. UPDATE: Things I have my eye on as they mature: Slint, egui, and iced. I'm especially watching iced as Pop_os is using it for…

For me the litmus test is if it has a fully-featured listview or treeview, so you can do something like a file browser, a library app, or other kinds of data-heavy apps. Also important is that keyboard and mouse work as expected (tabbing, shift-selection, etc).

Bonus if it supports the current "native" OS paradigms. E.g. on Mac: transparent sidebar, integrated titlebar, on Windows: MS office 2022 style simplified toolbar/ribbon, and WinUI styling. Note that even the official modern APIs themselves (SwiftUI and WinUI) don't do everything that first party apps can do.

Gtk doesn't look native anywhere but at least it has a very complete widget set and has been around for a while.

Post reply on HN