This commit is contained in:
2019-12-18 15:19:23 +00:00
parent f74f153569
commit 6a30c11edf
+26 -16
View File
@@ -1,27 +1,37 @@
package main
import (
"github.com/leaanthony/mewn"
"github.com/wailsapp/wails"
"time"
"fyne.io/fyne/app"
"fyne.io/fyne/widget"
)
func basic() string {
return "Hello World!"
func showTime(clock *widget.Label) {
formattedTime := time.Now().Format("03:04:05")
clock.SetText(formattedTime)
}
func main() {
app := app.New()
js := mewn.String("./frontend/dist/app.js")
css := mewn.String("./frontend/dist/app.css")
w := app.NewWindow("Clock")
// w.SetContent(widget.NewVBox(
// widget.NewLabel("Hello Fyne!"),
// widget.NewButton("Quit", func() {
// app.Quit()
// }),
// ))
app := wails.CreateApp(&wails.AppConfig{
Width: 1024,
Height: 768,
Title: "test",
JS: js,
CSS: css,
Colour: "#131313",
})
app.Bind(basic)
app.Run()
clock := widget.NewLabel("")
showTime(clock)
go func() {
t := time.NewTicker(time.Second)
for range t.C {
showTime(clock)
}
}()
w.SetContent(clock)
w.ShowAndRun()
}