Golearn: Added Ui library testing

This commit is contained in:
mollusk 2017-08-29 00:14:20 -07:00
parent a27f9d2a81
commit 1a1f22299f
2 changed files with 33 additions and 0 deletions

33
golearn/ui/main.go Normal file
View File

@ -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))
})
}
}

BIN
golearn/ui/ui Executable file

Binary file not shown.