Fyne GoLang GUI Course Text and Change Color – Tutorial 7

class 7 fyne GoLang GUI Text and Change Color

package main
// import Fyne
import (
"image/color"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/canvas"
)
func main() {
// Create new app
a := app.New()
// Create New Window and Title
w := a.NewWindow("My Canvas Text Tutorial")
// Resize window
w.Resize(fyne.NewSize(400, 400))
// Our Text widget in Canvas
//first value for label/cation
// 2nd for color value
// Now creating Color
colorx := color.NRGBA{R: 0, G: 0, B: 255, A: 255}
// R is Red and Range is zero to 255
// B is blue and G is Green
// A is for alpha for opacity
textX := canvas.NewText("Here is my blue text", colorx)
// Setup widget.
w.SetContent(textX)
w.ShowAndRun() // Show and run 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: