Random Number Generator – Fyne GUI Golang tutorial 16

Random Number Generator – Fyne GUI Golang tutorial 16


In this Tutorial We are going to code a Random Number Generator.

It is a full fledge App.

You can create GUI and EXE format and distribute it anywhere.

package main

// importing fyne
import (


func main() {
	// creating new app
	a := app.New()
	// New window and title
	w := a.NewWindow("Random Number Generator")
	// Resize
	w.Resize(fyne.NewSize(400, 400))
	// Label
	label1 := canvas.NewText("Rand Num Gen", color.Black)
	label1.TextSize = 40
	// Button
	btn1 := widget.NewButton("Generate", func() {
		// Ui is ready
		// Now logic
		rand1 := rand.Intn(1000)
		label1.Text = fmt.Sprint(rand1) //conver int to string
		label1.Refresh()                // refresh and render UI
	// Showing and setup content
		// more than on widget so use container newVbox
	//show and run


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: