Skip to content

Instantly share code, notes, and snippets.

@snyh
Last active December 23, 2015 22:09
Show Gist options
  • Save snyh/6701629 to your computer and use it in GitHub Desktop.
Save snyh/6701629 to your computer and use it in GitHub Desktop.
package main
import "dui"
import "fmt"
import "io/ioutil"
func main() {
dui.Init()
f := dui.NewFrame(300, 300)
content, _ := ioutil.ReadFile("/dev/shm/dui/Source/dui/test.htm")
f.LoadContent(string(content))
e := f.Ele("snyh")
fmt.Printf(e.Content())
var flag bool // support closure
f.Ele("button").SignalConnect("click", func() {
flag = !flag
if flag {
e.SetContent("one two three")
} else {
e.SetContent("three two one")
}
})
dui.Run()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment