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

[sourcecode lang=”go”] r, _ := fyne.LoadResourceFromPath("c:/assets/tree.jpg")[/sourcecode]
Now you can use this asset in the SetIcon function.
[sourcecode lang=”go”] a.SetIcon(r)[/sourcecode]
where ‘r’ is the variable of the resource.
[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

// import fyne
import (

func main() {
// New app
a := app.New()
r, _ := fyne.LoadResourceFromPath("c:/assets/tree.jpg")
// change icon
// New window/ title
w := a.NewWindow("change app icon")
w.Resize(fyne.NewSize(400, 400))

[/sourcecode] [easy_media_download url=”” text=”Download Code” color=”red_darker”]

Fyne Golang GUI Course

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: