init
This commit is contained in:
parent
b286312712
commit
7e62a47c11
|
|
@ -0,0 +1,3 @@
|
|||
go.sum
|
||||
fyne-demo
|
||||
*.app
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"fyne.io/fyne/v2/app"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
|
||||
func main() {
|
||||
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) {
|
||||
clock.SetText(time.Now().Format("03:04:05"))
|
||||
}
|
||||
31
go.mod
31
go.mod
|
|
@ -1,3 +1,34 @@
|
|||
module myschools.me/suguo/fyne-demo
|
||||
|
||||
go 1.19
|
||||
|
||||
require fyne.io/fyne/v2 v2.2.3
|
||||
|
||||
require (
|
||||
fyne.io/systray v1.10.1-0.20220621085403-9a2652634e93 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/fredbi/uri v0.0.0-20181227131451-3dcfdacbaaf3 // indirect
|
||||
github.com/fsnotify/fsnotify v1.5.4 // indirect
|
||||
github.com/fyne-io/gl-js v0.0.0-20220119005834-d2da28d9ccfe // indirect
|
||||
github.com/fyne-io/glfw-js v0.0.0-20220120001248-ee7290d23504 // indirect
|
||||
github.com/fyne-io/image v0.0.0-20220602074514-4956b0afb3d2 // indirect
|
||||
github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6 // indirect
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20211213063430-748e38ca8aec // indirect
|
||||
github.com/godbus/dbus/v5 v5.1.0 // indirect
|
||||
github.com/goki/freetype v0.0.0-20181231101311-fa8a33aabaff // indirect
|
||||
github.com/gopherjs/gopherjs v1.17.2 // indirect
|
||||
github.com/jsummers/gobmp v0.0.0-20151104160322-e2ba15ffa76e // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/srwiley/oksvg v0.0.0-20200311192757-870daf9aa564 // indirect
|
||||
github.com/srwiley/rasterx v0.0.0-20200120212402-85cb7272f5e9 // indirect
|
||||
github.com/stretchr/testify v1.7.2 // indirect
|
||||
github.com/tevino/abool v1.2.0 // indirect
|
||||
github.com/yuin/goldmark v1.4.0 // indirect
|
||||
golang.org/x/image v0.0.0-20220601225756-64ec528b34cd // indirect
|
||||
golang.org/x/mobile v0.0.0-20211207041440-4e6c2922fdee // indirect
|
||||
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d // indirect
|
||||
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect
|
||||
golang.org/x/text v0.3.7 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
honnef.co/go/js/dom v0.0.0-20210725211120-f030747120f2 // indirect
|
||||
)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/app"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
|
||||
func main() {
|
||||
a := app.New()
|
||||
w := a.NewWindow("Hello")
|
||||
|
||||
hello := widget.NewLabel("Hello Fyne!")
|
||||
w.SetContent(container.NewVBox(
|
||||
hello,
|
||||
widget.NewButton("Hi!", func() {
|
||||
hello.SetText("Welcome :)")
|
||||
}),
|
||||
))
|
||||
w.SetMaster()
|
||||
w.Show()
|
||||
|
||||
w2 := a.NewWindow("Larger")
|
||||
w2.SetContent(widget.NewButton("OK", func() {
|
||||
w3 := a.NewWindow("Thrid")
|
||||
w3.SetContent(widget.NewLabel("Thrid"))
|
||||
w3.Show()
|
||||
}))
|
||||
w2.Resize(fyne.NewSize(200, 200))
|
||||
w2.Show()
|
||||
|
||||
a.Run()
|
||||
}
|
||||
19
main.go
19
main.go
|
|
@ -1,5 +1,22 @@
|
|||
package main
|
||||
|
||||
func main() {
|
||||
import (
|
||||
"fyne.io/fyne/v2/app"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
|
||||
func main() {
|
||||
a := app.New()
|
||||
w := a.NewWindow("Hello")
|
||||
|
||||
hello := widget.NewLabel("Hello Fyne!")
|
||||
w.SetContent(container.NewVBox(
|
||||
hello,
|
||||
widget.NewButton("Hi!", func() {
|
||||
hello.SetText("Welcome :)")
|
||||
}),
|
||||
))
|
||||
|
||||
w.ShowAndRun()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue