Live data from Hacker News

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

news.ycombinator.com

91–100 of 112 posts

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

#91

I've had decent experiences with Python and Qt5. Windows was historically the painful part, but FBS¹ makes that a lot less painful nowadays. Tk also works reasonably well if you don't need the features and native integration that Qt offers (and I'm pretty sure FBS can handle Tkinter apps just fine). The .NET ecosystem is another solid choice for cross-platform desktop app development (and nowadays even mobile, too).…

fbs author here; thank you for the mention!

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

#92
The honest truth is that there is no good alternative here - there are only alternatives that are terrible in their own way.

Electron: Bloat, non-native, highly questionable language

Other cross-platform solutions: Obscure, (most often) non-native, undesirable language constraints, often far behind with regards to UI paradigms

Native UI for each platform with common code: requires deep knowledge of each platform, probably more time consuming than the other alternatives, the seam between common code and platform-specific code is often a source of errors

Fully separated native applications: Likely to produce the highest quality UIs, but requires the most diverse knowledge and time, more difficult to remain consistent across implementations, team size becomes an issue depending on how many platforms are supported

As much as I dislike Electron-applications, it's understandable why they became adopted so widely - the alternatives are just quite simply not great.

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

#94

One word: Lazarus. Cross platform done right (native code, no intepreter, no VM). Both IDE and generated code run native just about everywhere, from small ARM boards to virtual machines, and of course x86. As fast as C, decent sized executables, lots of built in or available libraries and components to do a lot of things, from managing databases to low level access to hardware, graphics, sound, etc. And of course it'…

Note for prospect Lazarus users: they use their own widget toolset that looks quite dated and doesn't really feel native, especially outside of Windows.

They don't integrate Qt widgets or other frameworks properly.

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

#95
I am making a simple image editor for myself to use on Linux, and honestly? After looking at different bindings for Qt and GTK on Go/Rust/Java and looking at other GUI frameworks (all of which are in beta state, it seems) I went back to Java+JavaFX.

There's a decent GUI markup editor (Scene Builder). There's no need to manually connect your handlers from XML markup to code - you can use annotations for that. There's HiDPI scaling that you can override if need be. There are Observable properties that you can bind to each other.

It's nice! Canvas and DrawingContext are a bit of a pain to use for my specific use-case, since it draws straight to buffer with no underlying Image, but I make do for now.

And you can take advantage of jlink to trim your JDK to modest sizes. There are also tools like Graal Native and Liberica Native Image Kit to compile your Java app down to binary, but I haven't toyed with those yet.

The cons are obvious: non-native look (you can try to style it with CSS, but there are no ready-made native looking solutions, I think, only different themes) and JVM startup time.

However, if you're willing to write C++, I'd argue Qt is the best choice right now. I just refuse to touch C/C++ with a ten-foot pole

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

#96
There's pywebview (https://github.com/r0x0r/pywebview/) which is a Python lib that uses whatever native webview implementation exists. Obviously means some compatibility work between each OS, but gives out very small apps what work very well on the whole. I'm using it on my cross platform email client (https://kanmail.io).

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

#97

In Solvespace we use native GUI on Windows, MacOS, and Linux (GTK). This is probably not what you want to do, as we don't use any GUI widgets - only popup dialogs and menus. Everything in the app itself is rendered using OpenGL. Even our "text window" is drawn using OpenGL and GNU unifont (this is something that really needs to change BTW). The platform abstraction code is here: https://github.com/solvespace/solvespa…

How’s accessibility?

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

#98
post #84
post #43

We write apps like this in Object Pascal using Lazarus. Think Delphi but open source. We have a suite of framework-specific developer apps for tasks like packaging deployments, managing common database tasks, onboarding new clients etc. They were written on Linux using Lazarus, then recompiled on MacOS and Windows as required. There are occasionally OS-specific variations for small pieces of these apps, but Object Pa…

Cool! May I ask what project you’re working on?

Seconded

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

#99
post #49

One word: Lazarus. Cross platform done right (native code, no intepreter, no VM). Both IDE and generated code run native just about everywhere, from small ARM boards to virtual machines, and of course x86. As fast as C, decent sized executables, lots of built in or available libraries and components to do a lot of things, from managing databases to low level access to hardware, graphics, sound, etc. And of course it'…

What's the Lazarus experience like for cross-compiling to other platforms? E.G. how hard is it to build a working result for Windows, OSX and Linux (maybe BSD) from Linux or BSD?

Maybe this crosscompiles, I have not tried it yet:

https://wiki.lazarus.freepascal.org/fpcupdeluxe

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

#100
post #74
post #32

Earlier quoted context omitted.

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 simi…

> You have the old Win32 / MFC style widgets

That's the one. Everything else has never gained enough traction.

Post reply on HN