Fyne GoLang GUI Course ICON – Tutorial 12
Here is the single line code to create a ICON widget.
// Creating Icon Widget IconX := widget.NewIcon(theme.CancelIcon())
Here is the 2nd step to show the content(ICON widget) on our screen(canvas)
// setup content w.SetContent(IconX)
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() }
Fyne GoLang GUI Course