Change & Customize app icons – Fyne GUI Golang tutorial 27
Change & Customize app icons – Fyne GUI Golang tutorial 27
It is very important to have a custom app icon and other graphics.
Fortunately it is very easy in Fyne GUI to use your own custom assets in your GUI APP.
How to use a default Fyne logo?
You can with “SetIcon” function. Example is given below
[sourcecode lang=”go”]w.SetIcon(theme.fyneLogo())[/sourcecode]How to use Custom Logo in Fyne App?
You have to load assets/ resource first from compute or internet. Like give below
// import fyne
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
)
func main() {
// New app
a := app.New()
r, _ := fyne.LoadResourceFromPath("c:/assets/tree.jpg")
// change icon
a.SetIcon(r)
// New window/ title
w := a.NewWindow("change app icon")
//resize
w.Resize(fyne.NewSize(400, 400))
w.ShowAndRun()
}