Disabled Button – Fyne GUI Golang tutorial 42

Disabled Button – Fyne GUI Golang tutorial 42



<div>package main</div>
<div>// import fyne</div>
<div>import (</div>
<div>    "fyne.io/fyne/v2"</div>
<div>    "fyne.io/fyne/v2/app"</div>
<div>    "fyne.io/fyne/v2/container"</div>
<div>    "fyne.io/fyne/v2/widget"</div>
<div>func main() {</div>
<div>    // new app</div>
<div>    a := app.New()</div>
<div>    // new window and title</div>
<div>    w := a.NewWindow("Disabled Button")</div>
<div>    // resize window</div>
<div>    w.Resize(fyne.NewSize(400, 400))</div>
<div>    disabled_button := widget.NewButton("Disabled",</div>
<div>        func() {})</div>
<div>    disabled_button.Disable()</div>
<div>    //this will disable btn</div>
<div>    w.SetContent(</div>
<div>        container.NewVBox(</div>
<div>            disabled_button,</div>
<div>        ),</div>
<div>    )</div>
<div>    // show and run</div>
<div>    w.ShowAndRun()</div>
Download Code

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: