Now that the library is installed, it's time to write some code. The following sample is andlabs UI equivalent of the hello world example we used in the Chapter 4, Walk - Building Graphical Windows Applications. Start by entering the following code into a new file, named hello.go:

package mainimport ""func main() {        err := ui.Main(func() {                window := ui.NewWindow("Hello", 100, 50, false)                window.SetMargined(true)                window.OnClosing(func(*ui.Window) bool {                        ui.Quit()                        return true                })                button := ui.NewButton("Quit")                button.OnClicked(func(*ui.Button) {                        ui.Quit()                })                box := ui.NewVerticalBox()                box.Append(ui.NewLabel("Hello World!"), false)                box.Append(button, false)                window.SetChild(box)                window.Show()        })        if err != nil { panic(err) ...

Get Hands-On GUI Application Development in Go now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.