Slider data binding – Fyne GUI Golang tutorial 41

Slider data binding – Fyne GUI Golang tutorial 41



</p><div><div>package main</div><br /><div>// import fyne</div><div>import (</div><div>    ""</div><div>    ""</div><div>    ""</div><div>    ""</div><div>    ""</div><div>)</div><br /><div>func main() {</div><div>    // New app</div><div>    a := app.New()</div><div>    // New window and title</div><div>    w := a.NewWindow("Slider &amp; data binding")</div><div>    // resize</div><div>    w.Resize(fyne.NewSize(400, 400))</div><div>    // first slider widget</div><div>    // 3 arguments</div><div>    // min value, max value, and data source</div><br /><div>    f := 20.0 // any float value</div><div>    data := binding.BindFloat(&amp;f)</div><div>    slider1 := widget.NewSliderWithData(</div><div>        0, 100, data)</div><div>    // Slider part is done</div><div>    // Now lets attach slider value with label</div><div>    label1 := widget.NewLabelWithData(</div><div>        binding.FloatToString(data),</div><div>    )</div><br /><div>    // we are done :)</div><div>    // Lets show and setup content</div><div>    w.SetContent(</div><div>        container.NewVBox(</div><div>            label1,</div><div>            slider1,</div><div>        ),</div><div>    )</div><div>    // Show data</div><div>    w.ShowAndRun()</div><div>}</div></div><p>


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: