- I want to make a native looking GUI
- Cross platform (macOS, Windows, Linux)
- With a sane language (no C, C++ or Objective C)
- Ideally with a data flow looking like unidirectional data flow / Elm architecture
What options do I have?
Most cross platform frameworks won't really look 100% native. The only exception I know is wxWidgets, which provides an abstraction layer over the native toolkits. It's written in C++ but there are bindings for Python, Ruby and other languages. But even using this, apps might not feel truly native. There is more to nativeness than looks. It's also about subtle conventions and ways to do things. You only achieve this when you use a native framework and pay a lot of attention to the HIG guidelines of the OS.
My personal (and perhaps a bit unpopular) opinion is that native looking is a bit overrated. And it's mostly macOS users who look for this. Linux and Windows users already get a lot of diversity in their looks and feel because there is no single framework for those OSes.
More important than native looking is to have a GUI that is fast, efficient and accesible. The best option that provides this in a cross platform way is QT. Java Swing and JavaFX are also good options.
The most productive tool to have cross platform GUIs right now is Electron. That's just a fact. And it's the reason why so many modern products are using it. But as we all know, there is a price in efficiency.
There are a bunch of new projects in the works to improve cross platform GUI for modern languages. JetPack Compose Desktop, Flutter, Slint and many more. But these are not yet fully mature.
Beware the bias of the loud minority. For every 1 noisy user, there may be 50 quiet users who are fine with the decision to use Electron.
Shipping beats not shipping every time, and if Electron is what you need, then do it. I say this as someone who does not like Electron, but also as someone who knows that writing comments on HN is 100x easier than actually shipping production software.
It does make GUI which are native to the platform but you get a small native binary which renders OpenGL.
Is Making Advanced GUI Applications with Godot the Future? https://medium.com/swlh/what-makes-godot-engine-great-for-ad...
Here is a simple Julia GTK project on GitHub: https://github.com/ordovician/RocketBuilder.jl
Some articles I wrote related to GTK programming with Julia and GTK in general:
- Understanding GTK Layouts: https://itnext.io/understanding-gtk-layouts-13e5a36256fa
- Hiccups Writing GTK3 GUI Code in Julia: https://towardsdev.com/hiccups-writing-gtk3-gui-code-in-juli...
If Julia is not your cup of tea then GTK can be used with Go and Swift as well.
While the Qt API is imperative (`self.layout.addWidget(self.text)`, ...), focusing on declative Qml whenever possible helps with a more declarative approach.
Why? The only way to get a truly native look and the ability to specialise for each OS. Maybe Windows does threading better than Linux and can be optimised in some way. Maybe Linux has some nicer native UI controls that could make that part better on Linux.
Otherwise cross-platform mostly means a UI that is not native looking on any platform. Haven't used QT recently but of all I used, that was the closest to what you are asking for (I was using C++ - sorry, it's not that bad!) but I think there are bindings in other languages, although they might well have some bugs compared to the basic C++ version.
I made something pretty complicated with tkinter and Python. It's not that hard to do but the result looks awful, it doesn't support many features people expect in 2022, and the documentation for using tk in Python is poor. You probably need to refer to the tcl/tk documentation and translate it in your head to apply to Python.
As much as people hate Electron, the rendering engine in a web browser is head and shoulders better than any other cross-platform system and I think it's a sane model for programming. The main trouble w/ Electron is that you have 30MB of runtime for any application, even if it something that could be coded in a 25k .EXE file based on Win32.
Now you can build completely native GUIs in the appropriate language for each platform. Start with the platform which will likely have the most users for the application. Bonus if the application is open source, other developers will build all kinds of native GUIs for you. Just look at how many GUIs are out there for things like PostgreSQL, Git, IRC, etc.
I know this doesn't exactly meet your requirements, but I think this is the way to go if starting something in August 2022.
I was considering using it for some app that otherwise would be PWA. While I didn't use in-depth features and didn't run into any serious problems, it is likely that not everything will be perfect, but it is also likely that overall experience will be more pleasant.
Check it out.
Though overall, its not an uncommon issue. I've found myself in the same place multiple times, I've even considered using a lightweight game engine just for their UI features. But next time I run into it, I imagine Flutter will be what I go with
Edit: Just realising you said "native-looking". Not so sure about Flutter for that, I'm not sure such a thing exists.
1. https://github.com/tauri-apps/tauri 2. https://github.com/zserge/lorca 3. https://github.com/webview/webview
There are some very powerful capabilities in Objective C (like swizzling) that can be of tremendous help when you have some oddball functionality to implement. This would be conceptually very similar to the monkey-patching that folks do with Python. Perhaps this is the sort of thing that makes it not sane to you?
- Native looking: MAUI supports native controls as much as possible
- Cross platform: Nearly everything but Linux today (and there are forks out there trying to bridge that gap); macOS (Catalyst), Windows, iOS, and Android
- C# as the default .NET option is a very sane language. Other options may be possible with more effort. (Some people are still working on that.)
- MAUI's focus is still on declarative XAML UI with databinding (MVVM), but there's a growing community for MVU (vaguely Elm-like) architecture including some official out-of-the-box support now.
After finishing, I regret spending so much time on it. For my use case, I think it would have been a better use of time to just use Electron. At least until .NET MAUI has Linux support, which is looking very promising.
[1] I haven't tried MacOS because I don't have a Mac and I believe it has OpenGL compatibility problems. It works great on Windows and Linux though.
Also java can run on any platform so javafx, etc..
- Qt: the most widely used, but is a little janky on macOS and they've been going down the JS route recently
- wxWidgets: is a possibility, I haven't used it in a long time.
- GTK: "native" for Linux, but technically cross-platform. However the experience is lousy (and it is C, not even C++)
- JUCE: another long-standing, somewhat niche toolkit, but I've never used it or anything written in it.
- Flutter: must use Dart as the language, as far as I'm aware. Also, not sure how native-looking it is.
There are also Java and C#, but I've never used a Java UI that looked or felt remotely native (or even "good" for that matter). Haven't used any C# apps but I assume some toolkits exist.
I happen to think Lazarus (based on Free Pascal) is great, but it's not a functional language at all.
https://github.com/fyne-io/fyne
I done research and have found golang fune is able to run even on thin devices. It core depend on open gl and can be changed to run with messa for embeeded device displays. https://pirogove.blogspot.com/
In the free world, I'd say Racket is the next best thing. Native UI, runs on anything. But you have to fall in love with Scheme. It's easy for me, I'm already sold.
I haven't found anything else that a) doesn't break in production, or 2) turns out to be a giant pain in the.
You've shared technical requirements, but you haven't shared business requirements. You should ask yourself whether you can actually achieve your business / user ends with a cross-platform approach. The three platforms are unique and users across the three have different expectations. For example as a Mac user, unless the software is super specialized such that there isn't any competition, a native Mac-focused solution will always be preferable to something that "kinda sorta" looks and acts like Mac software.
Without knowing the purpose of the software you are building, one has to really wonder if it needs to be native or should rather be a web app (for example), or even mobile first or tablet preferred.
Just some thoughts.
If you don't actually care about creating platform native UIs, you'll always be creating something that is a second-class design while putting in first-class effort. Why?
Frankly, you're better off just learning the operating system platform native UI programming language and get over yourself if you want to create something that looks like it was actually designed for the OS you're using.
And really, it's immature and insulting to call languages insane. Suck it up, these are peoples' professions here. No one wants to read that.
Personally I searched for many years for the perfect GUI system, the unicorn, but never found any. By doing a stricter prioritization I came to the conclusion that writing in a modern language is overrated.
Maybe look into Skia, it’s Googles abstraction layer for multiple graphics libraries on multiple platforms.
But if you are just learning, I wouldn’t concern yourself with any of those sort of environment conditions, just figure out how to make something that works on your preferred OS.
For example, if you use Windows, learn 2d rendering with direct x. Learn about event handlers for controller interaction. And of course read about MVC.
https://gitlab.com/sciter-engine/sciter-js-sdk
*Edit Also checkout https://haxe.org/
Cross platform GUI toolkit is a very underdeveloped area.