Live data from Hacker News

Ask HN: How do you create a cross-platform GUI without using Electron?

news.ycombinator.com

71–80 of 112 posts

Re: Ask HN: How do you create a cross-platform GUI without using Electron?

#71
post #65

This thread doesn't inspire confidence. It's mostly small and unproven projects, some maintained by hobbyists. I think the mess we're in with GUIs is because we've failed to find a way to convey at a very high level what the inputs and outputs of software are. In a utopian world, you'd define what you want the user to see and how the user can interact with the information. Something would then work out how to lay tha…

It's often trivial to cross-compile a basic command like program, OS filesystem specifics might be a small issue but there it's generally Windows vs everything else. Building one (mostly shared) codebase for different platforms is fine; or even shipping a script that's run locally.

However the solution to this problem needs:

  * To already be installed on every updated OS
  * Work, mostly, the same across every OS
  * Include the widgets we know from the last 20-30 years.
It's mostly that first bullet-point that's the killer. Windows needs it. OSX needs it. Neither the end user nor the application developer should have to worry about it staying updated.

I'd be happy enough if, across all the major OS today, I could use a pipe or localhost socket to talk to the browser and use it to render a webpage within a basic OS window (ZERO other browser decoration or interactions, still OS decorated). If THAT alone worked on every operating system that would be enough of a basic step for 99% of the CRUD style apps out there. Small extra bonus if a message-passing interface worked between the two.

Re: Ask HN: How do you create a cross-platform GUI without using Electron?

#72

Is there a particular language that you needed to use or have skills in? That's a very important qualifier.

Python, JavaScript a little of C, and similars

So in Python, you can use Qt but I am not sure how their licensing works. You can give Tkinter a try in Python since it's a "default". Also there's Kivy but I don't have experience in that.

As for Javascript, you can use Electron or React Native but I don't know how far along React Native on the desktop is compared to Electron.

Hope that helps and someone may come along that could speak in more depth on one or more of these packages for your use case.

Re: Ask HN: How do you create a cross-platform GUI without using Electron?

#73
post #9

I'll get shot for suggesting this most places, but I feel like GTK has the most 'native' feel across every operating system. That's not to say that it's easy to get working (setting up proper build targets is going to be your biggest hurdle), but your reward is a stylish and robust UI with proper touchscreen support on Windows/Linux.

> but I feel like GTK has the most 'native' feel across every operating system

That's not true since GTK3, where GTK started to look like GTK regardless of the platform.

Re: Ask HN: How do you create a cross-platform GUI without using Electron?

#74
post #32
post #23

I personally like wxWidgets: https://www.wxwidgets.org/ It's open source, the code has always felt reasonably clean to me, and it gives your apps native look and feel.

I second this choice. It is the only toolkit that looks native in Windows. And it is ridiculously fast compared to alternatives.

I'm currently writing a cross-platform toolkit, and I'd like to know what native looks like in Windows. As far as I can tell it's worse than Linux. You have the old Win32 / MFC style widgets, and programs like Notepad++ that use something that looks similar. There's the style that much (but not all) of the Control Panel seems to use (is the name Metro?), but the only application that I've used that uses anything similar to that is the Edge browser. There's also the MS Office style, but that seems like a one-off, except that Explorer seems to use it. I've heard things about WFC, which seems to be deprecated, no idea what it looks like. I really dislike the Windows experience, so I have limited recent experience since I avoid using it as much as possible, but so far every application I've used looks different.

I'd like to know what the "native experience" is supposed to be, but I have no idea which of the numerous Microsoft UI APIs is officially current. So far I've just punted and I'm using macOS shapes and sizing and using the colors from the Metro? style; at least it will look tasteful and not stand out too much color-wise.

Re: Ask HN: How do you create a cross-platform GUI without using Electron?

#75
post #65

This thread doesn't inspire confidence. It's mostly small and unproven projects, some maintained by hobbyists. I think the mess we're in with GUIs is because we've failed to find a way to convey at a very high level what the inputs and outputs of software are. In a utopian world, you'd define what you want the user to see and how the user can interact with the information. Something would then work out how to lay tha…

I think part of the problem is that different OS chromas have different native widget sizes, and possibly different layouts. If you create a UI for Windows and just switch to the macOS chroma, it will have weird spacing, and I don’t think there’s a general way to fix this. Converting to the iOS chroma is even worse, with checkboxes -> switches, radios -> tables, and the combination of smaller screen + bigger controls.

So the solution for cross-platform apps is to use a non-native chroma which is the same for each OS. But that brings you to Qt or JavaFX or Electron.

Re: Ask HN: How do you create a cross-platform GUI without using Electron?

#76

Java and Swing are still a great option.

Ugh, I'd rather have the electron app. I've never seen a Java application that didn't garishly stand out, the widgets do not act at all native, and it's inevitably sluggish. Although, the biggest offenders I've used are Eclipse and IntelliJ IDEA, both of which at least have some excuse. I hate using both, though, and VS Code, which I believe is Electron-based, does not feel sluggish the way the other two do.

Re: Ask HN: How do you create a cross-platform GUI without using Electron?

#78
The trade off is always between cross-platform and native integration. For example, do you want to write an app that feels like a MacOS application? You have to use AppKit to really get that feel, and then it’s not cross platform.

There’s really 3 choices that I see, and have done all of them:

1) just build native UIs for each platform. This is the most time consuming, but the best end result in my opinion. The apps _feel_ the best on each platform

2) make a web app. Electron apps are still web apps.

3) hybrid approach, where part of your logic is shared across different native UIs, let’s say with a C++ / Rust / Java / Kotlin library. This is also a spectrum. Your library can just have common glue / networking code, all the way up to drawing its own graphics before turning a full screen over to the native UI framework.

I guess there’s also 4, which is Flutter, but that’s really just a pre-packaged #3.

If you ask me, web just has the best delivery model, and that trumps everything. Responsive web app plus a native option via Electron is the way to go.

Re: Ask HN: How do you create a cross-platform GUI without using Electron?

#79
As far as I am aware Qt is the only cross-platform toolkit that has reasonable traction, and it has been successfully used by commercial applications. Other cross-platform applications are either so old that there was no other choice but to write their own toolkits, or they are web browsers where you might as well write your own toolkit since you already have to do much of the work to render the HTML.

Unfortunately, "well-integrated" and "cross-platform" are fairly mutually exclusive, kind of by definition. I'm not sure if the API model for Windows and macOS even have a generalizeable common model. (They might, they might not, I've not investigated, and it would depend on which of the many MS UI APIs you are using)

Re: Ask HN: How do you create a cross-platform GUI without using Electron?

#80
post #13

It would be really nice if there was a shared widget API that would work for the major operating systems. If most of simple app could work on Windows, OSX, maybe mobile (Android / iOS) and Linux / BSD. Something that was mostly native for all of them. Currently the only alternative to Electron that is similar is a program that hosts a local webserver and the local browser is pointed at it, but that's a second class e…

[deleted]
Post reply on HN