diff --git a/golearn/ui/main.go b/golearn/ui/main.go new file mode 100644 index 0000000..366a3c9 --- /dev/null +++ b/golearn/ui/main.go @@ -0,0 +1,33 @@ +package main + +import ( + "strconv" + "time" + + "github.com/andlabs/ui" +) + +func main() { + err := ui.Main(func() { + window := ui.NewWindow("title", 200, 100, false) + label := ui.NewLabel("text") + window.SetChild(label) + window.OnClosing(func(*ui.Window) bool { + ui.Quit() + return true + }) + window.Show() + go counter(label) + }) + if err != nil { + panic(err) + } +} +func counter(label *ui.Label) { + for i := 0; i < 5; i++ { + time.Sleep(time.Second) + ui.QueueMain(func() { + label.SetText("number " + strconv.Itoa(i)) + }) + } +} diff --git a/golearn/ui/ui b/golearn/ui/ui new file mode 100755 index 0000000..8ec8557 Binary files /dev/null and b/golearn/ui/ui differ