Live data from Hacker News

Ask HN: How to make a native GUI with a modern language?

news.ycombinator.com

101–110 of 145 posts

Re: Ask HN: How to make a native GUI with a modern language?

#101
post #39

I hate to stick my neck up here but looking at this recently, I think that in trying to get cross-platform, you might end up with a lot of pain and not that great results. Instead, I would go for getting 3 devs and writing an app in a native language on each OS. You can refactor the business logic into a dll using some standard languages like C/C++ (they aren't that bad) and possibly Python and then just build the fr…

If you go this route I would mention that I had a really good experience creating a C library in Rust. Lets you use a modern language for your shared logic but still be very portable. I believe you can do the same thing with Zig and maybe Nim as well. And there are probably others

Re: Ask HN: How to make a native GUI with a modern language?

#102
If you are fine with using Common Lisp, then Lispworks CAPI [1] and CLOG [2]. There are other options as well, the threads below can point you to those.

[1] https://news.ycombinator.com/item?id=13952643

[2] https://news.ycombinator.com/item?id=29181404

Re: Ask HN: How to make a native GUI with a modern language?

#103
All the well-known cross-platform toolkits are C/C++, so you'll have to find bindings for whatever "sane" language you want to use. Your options are basically:

- 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.

Re: Ask HN: How to make a native GUI with a modern language?

#104
post #14

Personally I like JavaFX. 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 br…

> trouble w/ Electron is that you have 30MB of runtime for any application JavaFX has the same problem? Or you rely on user's JREs already installed? I'd think 30MB really isn't much any more.

Not anymore.

To put things in perspective, my first hard drive, back in 1989, was 30 megabytes. I think it did about 500Kbytes/sec for reads. I also had a 2400 baud modem.

Today, 30 megabytes is a 1 second download on a bad day.

Re: Ask HN: How to make a native GUI with a modern language?

#106

I write native GUIs in GTK using Julia at the moment. Julia is one of the most modern languages you can use today. Multiple-dispatch, very functional, modern package management and virtual environments, high performance, modern sophisticated REPL environment. GTK is quite nice as Glade is one of the nicer GUI designers. Here is a simple Julia GTK project on GitHub: https://github.com/ordovician/RocketBuilder.jl Some…

Have you tried / had good luck doing static compilation of Gtk applications?

Re: Ask HN: How to make a native GUI with a modern language?

#107

> HN has strong opinions against Electron 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 producti…

Part of me wonders why someone hasn't tackled creating an Electron runtime service, so that each installed app doesn't load what could be a shared library into memory. There's a host of complicated problems there, but if the major issue is fat runtimes it can be pared down like Chrome workers.

So... the system WebView library?

Re: Ask HN: How to make a native GUI with a modern language?

#108

Earlier quoted context omitted.

They don't have FX installed. No one does. The whole idea of using Java is to support something other than Windows. I use a Mac and all companies I worked with had all common OS's on desktops. The edge cases are the problem. This isn't a product for other engineers. At least not engineers who have experience with JVM conflict issues. For end users and to get a smooth installer experience there's a huge distance. Cust…

I can't use jpackage on Windows to build Mac binaries, but not having FX installed is what kind of problem? Just use jpackage to create an .app for Mac, an installer or portable build for Windows, and a .deb or executable binary for Linux. It bundles all dependencies and users can just click and run it.

That's indeed what we do in our CI but it gets very hairy and the end result is often subpar in nuanced ways. E.g. signing a bundle which required us to upgrade our whole CI infrastructure because we had to move to a newer VM.

The bundle is huge because it needs to include a JRE and JavaFX. The install process and bundle building is complex. Especially with signing. And you need to do it all for every platform.

Re: Ask HN: How to make a native GUI with a modern language?

#109
post #57

> HN has strong opinions against Electron 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 producti…

I usually agree with this sentiment of shipping vs not shipping. But Electron is just really bloated. You cannot install 10 apps and regularly use it. Most systems will just hang or crawl. Systems with 8GB should not be hanging because you are using 10 apps. I have 16GB RAM and even then I feel the hog with Discord, Slack, VS Code, A note app taking up too much memory. Then there is unnecessary security risk of bring…

The secret is to have your employer buy you a brand new top spec MacBook Pro every two years, then it's fast enough and doesn't bother you. That's also what all the Electron devs are doing.

Re: Ask HN: How to make a native GUI with a modern language?

#110
post #95

Having a native looking GUI and being cross platform is almost contradictory. The only way to make truly native looking and feeling GUIs is to use native tools. That means Cocoa on macOS, Gtk or Qt on Linux, and Win32/Winforms/WPF/WinUI on Windows. 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 wr…

> 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. I would echo this. Consider applications like Photoshop or Blender, these don't really have a 'native' feel anywhere but their UX is generally responsive. On the other hand you have Electron applications that don't f…

What does Photoshop use?
Post reply on HN