GoLang GUI Libraries

20 Jun 2018
 

At work, I’ve recently had the need to create simple desktop programs for Windows to provide more effective user interfaces to configure and launch a number of scripts. And, mainly because I’ve been really enjoying using the language lately, I decided to use Go to write it… Problem is, there aren’t very many libraries available to do this that are stable and complete! In this blog post, I hope to highlight some of the more promising ones.

Qt bindings

There are a couple of projects on Github claiming almost complete Go bindings for Qt. Although I’ve found Qt to be very useful for similar things in the past, the ~35GBs for Qt itself, and relatively complex setup were enough to put me off even trying these libraries out. But they do exist! There is a nice list of libraries for building GUI programs here, you’ll be able to find the more popular Qt bindings there, as well as many other options.

Walk

Windows Application Library Kit. This one looked very promising at first, it’s Windows-specific and can be set up using go get. I’ve also read a few articles praising it. My personal experience was okay, I think I could have used it if I’d needed to. It isn’t the most complete but it’s not bad, and its declarative subpackage can make code actually arranging the interface widgets more readable than other options. In the end, it still had some of the same problems as other options and I’d prefer something with a bit better documentation.

ui

ui is a very simple cross-platform GUI library based on libui (a C GUI library by the same author). Ultimately, it’s the option I chose to use. I found it very easy to set up (it also supports go get) and to use. It got the job done! The main drawback, as with most of the options, is completeness. As of writing this post, there is no text area widget (however, another fork of the project has one!). I ran into other issues due to lacking features but there was always a solution/workaround easy enough to be found.