Fyne GoLang GUI Course TEXT Label – Tutorial 3

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

fmt.Sprintf(“%d”, myInt)
widget.NewLabel(fmt.Sprintf(“%d”, myInt))

Convert bool to String

fmt.Sprintf(“%t”, mybool)
widget.NewLabel(fmt.Sprintf(“%t”, mybool))
package main
import (
// importing fyne
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.ShowAndRun() // Running app
Download Code


Tony BB

TonyBB is a Coach , marketer, hypnotist and a founder of RSKVF Production who specializes in providing simple, affordable, and easy to use solutions for Life.

Click Here to Leave a Comment Below 0 comments

Leave a Reply: