Platform-native GUI library for Go.
The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:
This is a library that aims to provide simple GUI software development in Go. It is based on my libui, a simple cross-platform library that does the same thing, but written in C.
It runs on/requires:
sudo apt-get install libgtk-3-dev
sudo dnf install gtk3-devel
It also requires Go 1.8 or newer.
It currently aligns to libui's Alpha 4.1, with only a small handful of functions not available.
Package ui is currently mid-alpha software. Much of what is currently present runs stabily enough for the examples and perhaps some small programs to work, but the stability is still a work-in-progress, much of what is already there is not feature-complete, some of it will be buggy on certain platforms, and there's a lot of stuff missing. The libui README has more information.
Once you have the dependencies installed, a simple
go get github.com/andlabs/ui/...
The in-code documentation is sufficient to get started, but needs improvement.
Some simple example programs are in the
directory. You can
each of them individually.
Package ui requires a manifest that specifies Common Controls v6 to run on Windows. It should at least also state as supported Windows Vista and Windows 7, though to avoid surprises with other packages (or with Go itself; see this issue) you should state compatibility with higher versions of Windows too.
The simplest option is provided as a subpackage
; you can simply import it without a name, and it'll set things up properly:
import \_ "github.com/andlabs/ui/winmanifest"
You do not have to worry about importing this in non-Windows-only files; it does nothing on non-Windows platforms.
If you wish to use your own manifest instead, you can use the one in
as a template to see what's required and how. You'll need to specify the template in a
file and use
in MinGW-w64 to generate a
file as follows:
windres -i resources.rc -o winmanifest\_windows\_GOARCH.syso -O coff
You may also be interested in the
packages, which provide other Go-like options for embedding the manifest.
Note that if you choose to ship a manifest as a separate
file instead of embedding it in your binary, and you use Cygwin or MSYS2 as the source of your MinGW-w64, Cygwin and MSYS2 instruct gcc to embed a default manifest of its own if none is specified. This default will override your manifest file! See this issue for more details, including workaround instructions.
If you run a macOS program binary directly from the command line, it will start in the background. This is intentional; see this for more details.