Hacker News new | ask | show | jobs
by mrlemke 1556 days ago
I have goofed around a little bit with GUI programming for Go. Fyne is incomplete, but I did find it relatively simple to slap something together. It may turn out to be a good cross-platform toolkit in the future, but I didn't like the requirement on OpenGL. Not my choice, but the utility needed to run on Windows 7 and I don't like updating drivers on the machine (risky).

Webview works ok, and you can get a lightweight Electron-like thing going that uses your existing browser. This reduces binary size greatly. I didn't try any JavaScript frameworks with it, just vanilla JS. You can bidirectional bind between JavaScript and Go too.

What I liked the most was gothic, since Tk looks good enough and runs on Windows 7 easily. Gothic is a Tk binding for Go that is quite simple to use. However, you are writing the GUI in Tk now, and you will either love it or hate it. I do have a bias for Tcl, so it was appreciated.

My use case scenario was supporting an old machine running Windows 7 with mediocre video. I ended up just using Tcl/Tk without Go since it was simpler and reduced a layer (Tcl->Go->C). When it comes to writing small and/or inhouse stuff, I found it easy and fast to just slap out a Tcl/Tk app and call it a day. I can develop on my Linux/BSD box and then just Windows specific bits if necessary and it usually Just Works(tm).

Oh, it should be noted that Python + Tkinter is a decent alternative for those of you needing executables. Pyinstaller is basically a "one-click" and works with bundling Tkinter. Roy Keene has done good work putting together kitcreator for Tcl, but pyinstaller is simpler if you don't understand the magic.

3 comments

Fyne seems to be the closest thing to cross-platform GUI that Go has.

Fyne-cross is a really nice tool that can cross-compile Fyne applications for most popular systems (including android).

The libGL1 dependency under Linux is a fair tradeoff for wide compatibility - the drivers don't have stable ABI so dynamic linking to libGL1 is a must[0].

Python + Tkinter + Pyinstaller works, but does not support cross-compilation, and I've personally had some portability issues with it (e.g. under Linux, the GUI mainloop doesn't work outside of the main thread; under Windows, if you start a Process after setting up GUI, each process will create its own window, so you must start all the Process-es beforehand).

[0] https://github.com/fyne-io/fyne/issues/512

Cross-compilation would be nice. I have used asyncio to allow the GUI to run in the main thread but have other processing done separately. I am not sure I understand why you are getting a new window on Windows. Were you trying to create new windows separate from the thread the root window is in?
Actually, I didn't remember it right, it wasn't tkinter. It was probably some other popular GUI library. I just tested tkinter + threading/multiprocessing on Python 3.4.3 on Windows 7, and it works fine. I'm sorry for the false information.
No problem, stuff happens. :)
I used to like fyne a lot, it is simple yet very extensible, much more approachable than other mainstream GUI binding like QT. however like OP mentioned fyne is not production ready yet, one key issue for me is IME support, it is based on glfw, and glfw doesn't have proper support for IME input.
The easiest way is to just use the Flutter binding.
How's that?
UI quality is much higher but the bindings are all third party software, not official Google products.