70 lines
1.3 KiB
Go
70 lines
1.3 KiB
Go
package main
|
|
|
|
import (
|
|
"fyne.io/fyne/v2/app"
|
|
"fyne.io/fyne/v2/widget"
|
|
)
|
|
|
|
func main() {
|
|
myApp := app.New()
|
|
myWindow := myApp.NewWindow("Label Widget")
|
|
|
|
content := widget.NewLabel("text")
|
|
|
|
myWindow.SetContent(content)
|
|
myWindow.SetFullScreen(true)
|
|
myWindow.ShowAndRun()
|
|
}
|
|
|
|
//package main
|
|
//
|
|
//import (
|
|
// "image/color"
|
|
// "os"
|
|
// "strconv"
|
|
// "time"
|
|
//
|
|
// "fyne.io/fyne/v2"
|
|
// "fyne.io/fyne/v2/app"
|
|
// "fyne.io/fyne/v2/canvas"
|
|
//)
|
|
//
|
|
//func main() {
|
|
// size, err := strconv.Atoi(os.Args[1])
|
|
// if err != nil {
|
|
// // ... handle error
|
|
// panic(err)
|
|
// }
|
|
//
|
|
// a := app.New()
|
|
// w := a.NewWindow("Alert")
|
|
//
|
|
// // Fullscreen red rectangle
|
|
// rect := canvas.NewRectangle(color.RGBA{255, 0, 0, 255})
|
|
// alertText := canvas.NewText("ALERT", color.RGBA{255, 255, 255, 255})
|
|
// alertText.TextSize = float32(size) // Set text size
|
|
// alertText.Move(fyne.NewPos(250, 250)) // Position the text
|
|
// alertText.Alignment = fyne.TextAlignCenter
|
|
//
|
|
// w.SetContent(rect)
|
|
// w.SetContent(alertText)
|
|
// w.SetFullScreen(true)
|
|
//
|
|
// // Flashing animation
|
|
// anim := canvas.NewColorRGBAAnimation(
|
|
// color.RGBA{255, 0, 0, 255},
|
|
// color.RGBA{0, 0, 0, 255},
|
|
// 500*time.Millisecond,
|
|
// func(c color.Color) {
|
|
// rect.FillColor = c
|
|
// rect.Refresh()
|
|
// },
|
|
// )
|
|
//
|
|
// anim.AutoReverse = true
|
|
// anim.RepeatCount = fyne.AnimationRepeatForever
|
|
// //anim.Start()
|
|
//
|
|
// w.ShowAndRun()
|
|
//}
|