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.
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() }
Fyne GoLang GUI Course