Class 9 fyne GoLang GUI Circle
How to draw basic drawing shapes in fyne?
This tutorial is all about circle in fyne. Sometime we need to draw circle and other objects 🙂
[sourcecode lang=”go” autolinks=”false” classname=”myclass” collapse=”false” firstline=”1″ gutter=”true” highlight=”1-3,6,9″ htmlscript=”false” light=”false” padlinenumbers=”false” smarttabs=”true” tabsize=”4″ toolbar=”false” title=”Source Code
main.go”]
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 new window
w := a.NewWindow("Title : Circle")
// window resize
circle1 := canvas.NewCircle(color.NRGBA{R: 0, G: 0, B: 255, A: 255})
circle1.StrokeColor = color.NRGBA{R: 255, G: 0, B: 0, A: 255}
circle1.StrokeWidth = 33 // Stroke width
//Setup content
w.SetContent(circle1)
w.Resize(fyne.NewSize(400, 400))
w.ShowAndRun()
}
Fyne GoLang GUI Course