Browse Source

完善项目信息

master
VIVIMAN 3 years ago
parent
commit
75b5410f29
  1. 95
      golang_learn/data_func/go_to_fyne/demo/main.go
  2. 3
      golang_learn/data_func/go_to_linux/demo02/main.go

95
golang_learn/data_func/go_to_fyne/demo/main.go

@ -0,0 +1,95 @@
package main
import (
"fyne.io/fyne"
"fyne.io/fyne/container"
"time"
"fyne.io/fyne/app"
"fyne.io/fyne/widget"
)
func main() {
// demo01()
// demo02()
// demo03()
demo04()
}
// demo04 单元测试
func demo04() {
a := app.New()
w := a.NewWindow("Hello Person")
w.SetContent(container.NewVBox(makeUI()))
w.ShowAndRun()
}
func makeUI() (*widget.Label, *widget.Entry) {
out := widget.NewLabel("Hello world!")
in := widget.NewEntry()
in.OnChanged = func(content string) {
out.SetText("Hello " + content + "!")
}
return out, in
}
// demo03 设置窗口大小 - 控制主窗口
func demo03() {
a := app.New()
w := a.NewWindow("Hello World")
w.SetContent(widget.NewLabel("Hello World!"))
w.Show()
w2 := a.NewWindow("Larger")
// 区别位置
// w2.SetContent(widget.NewLabel("More content"))
w2.SetContent(widget.NewButton("Open new", func() {
w3 := a.NewWindow("Third")
w3.SetContent(widget.NewLabel("Third"))
w3.Show()
}))
w2.Resize(fyne.NewSize(100, 100))
w2.Show()
a.Run()
}
// demo02 设置窗口大小
func demo02() {
a := app.New()
w := a.NewWindow("Hello World")
w.SetContent(widget.NewLabel("Hello World!"))
w.Show()
w2 := a.NewWindow("Larger")
w2.SetContent(widget.NewLabel("More content"))
w2.Resize(fyne.NewSize(100, 100))
w2.Show()
a.Run()
}
// demo01 更新界面的内容
func demo01() {
a := app.New()
w := a.NewWindow("Clock")
clock := widget.NewLabel("")
updateTime(clock)
w.SetContent(clock)
go func() {
for range time.Tick(time.Second) {
updateTime(clock)
}
}()
w.ShowAndRun()
}
func updateTime(clock *widget.Label) {
formatted := time.Now().Format("Time: 03:04:05")
clock.SetText(formatted)
}

3
golang_learn/data_func/go_to_linux/demo02/main.go

@ -45,7 +45,8 @@ func main() {
} }
defer session.Close() defer session.Close()
//执行远程命令 //执行远程命令
combo, err := session.CombinedOutput("whoami; cd /opt/cn.com.epsoft.qggwy/qggwy/mysql/bin; ./mysql -uroot -padmin") // combo, err := session.CombinedOutput("whoami; cd /opt/cn.com.epsoft.qggwy/qggwy/mysql/bin; ./mysql -uroot -padmin")
combo, err := session.CombinedOutput("whoami; cd /opt/apps/cn.com.epsoft.qggwy/files/qggwy/kingbase/bin; ./ksql -h127.0.0.1 -p35017 -Uhy_qggwy -dTEST; hy_qggwy")
if err != nil { if err != nil {
log.Fatal("远程执行cmd 失败", err) log.Fatal("远程执行cmd 失败", err)
} }

Loading…
Cancel
Save