class 5 fyne GoLang GUI checkbox

Have you ever used checkboxes in web or school exam or Microsoft office? Or while doing HTML & CSS practice.
Here we are going to create the same here.

[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 (
"fmt"

"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"

"fyne.io/fyne/v2/widget"
)

func main() {
// New App
a := app.New()
// New Window and title
w := a.NewWindow("Here is check box tutorial title")
// Resizing window of App
w.Resize(fyne.NewSize(400, 400))

// check box widget
checkbox1 := widget.NewCheck("Male", func(b bool) {
if b == true {
fmt.Println("Male")
} else {
fmt.Println("Not Male")
}

})

// set up content
w.SetContent(checkbox1)
// running and showing app
w.ShowAndRun()
}

[/sourcecode]

 

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