Class 3 fyne GoLang GUI TEXT Label
How to create your first Text Label in Fyne GUI?
It is very easy to create a Label
widget.NewLabel(“Here is my Lable”)
Now you can change it to any value.
But it should be string.
If you want to use any other data type you need to convert to string.
Which is again very easy.
Convert integer to String
Convert bool to String
package main
import (
// importing fyne
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/widget"
)
func main() {
// New app
a := app.New()
//New Window
w := a.NewWindow("Here is my title for 3 tutorial")
// Resize Windows
w.Resize(fyne.NewSize(300, 300))
// Our First widget
labelX := widget.NewLabel("I can write anything")
w.SetContent(labelX)
w.ShowAndRun() // Running app
}
Fyne GoLang GUI Course