February 2019
Intermediate to advanced
450 pages
11h 59m
English
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 "github.com/andlabs/ui"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) ...Read now
Unlock full access