Fyne GoLang GUI Course Canvas Rectangle – Tutorial 10

Class 10 fyne GoLang GUI Canvas Rectangle

package main
// importing fyne
import (
"image/color"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/canvas"
)
func main() {
// creating app
a := app.New()
// creating windows
w := a.NewWindow("Rectangle : Canvas")
rect := canvas.NewRectangle(color.Black)
//fill color
rect.FillColor = color.NRGBA{R: 255, G: 255, B: 0, A: 255}
rect.StrokeColor = color.NRGBA{R: 255, G: 0, B: 0, A: 255}
rect.StrokeWidth = 5.0
//setup content
w.SetContent(rect)
//resizing window
w.Resize(fyne.NewSize(400, 400))
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: