Fyne GoLang GUI Course ICON – Tutorial 12

Here is the single line code to create a ICON widget.
[sourcecode lang=”go”] // Creating Icon Widget
IconX := widget.NewIcon(theme.CancelIcon())
[/sourcecode]

Here is the 2nd step to show the content(ICON widget) on our screen(canvas)
[sourcecode lang=”go”]

// setup content
w.SetContent(IconX)
[/sourcecode] [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 (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
)

func main() {
// creating app
a := app.New()
// create window
w := a.NewWindow("Icon : tutorial")
//resizing windows
w.Resize(fyne.NewSize(400, 400))
// Creating Icon Widget
IconX := widget.NewIcon(theme.CancelIcon())

// setup content
w.SetContent(IconX)
// show windows
w.ShowAndRun()
}

[/sourcecode] [easy_media_download url=”http://blogvali.com/wp-content/uploads/fyne-golang-downloads/main12.go” 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: