This is a creation in Article, where the information may have evolved or changed.
What's wasting today is tomorrow to those who died yesterday; What's the future of hate now?
What you are wasting today is the tomorrow that the man who died yesterday expects, and what you dislike is now the future you will never go back to.
I started Golang GUI, just want to do some small tools for daily use, because the love of Golang has reached the point of intoxicated.
Start today's Lxn/walk exercise:
package mainimport ("encoding/json""github.com/lxn/walk". "github.com/lxn/walk/declarative")func main() {var inTE, outTE *walk.TextEditMainWindow{Title: "格式化工具",MinSize: Size{600, 400},Layout: VBox{},Children: []Widget{HSplitter{Children: []Widget{TextEdit{AssignTo: &inTE},TextEdit{AssignTo: &outTE, ReadOnly: true},},},PushButton{Text: "格式化",MinSize:Size{150, 36},OnClicked: func() {var jsonStr interface{}err := json.Unmarshal([]byte(inTE.Text()), &jsonStr)jsonStr, _ = json.MarshalIndent(jsonStr, "\r\n", "\t")if err != nil { // 暂时未找到设置颜色值//outTE.SetTextColor(walk.Color(32))outTE.SetText("数据格式不正确")} else {outTE.SetText(string(jsonStr.([]uint8)))}},},},}.Run()}
This case is tested on Windows 10.
Run first use the RSRC tool to compile the load manifest file, then build the executable file