30 lines
757 B
Go
30 lines
757 B
Go
package main
|
|
|
|
import (
|
|
"fyne.io/fyne/v2/app"
|
|
"fyne.io/fyne/v2/container"
|
|
"fyne.io/fyne/v2/data/binding"
|
|
"fyne.io/fyne/v2/layout"
|
|
"fyne.io/fyne/v2/widget"
|
|
"git.martyn.berlin/martyn/fyne-widgets/pkg/vumeter"
|
|
)
|
|
|
|
func main() {
|
|
a := app.New()
|
|
w := a.NewWindow("VUMeter")
|
|
level := binding.NewFloat()
|
|
levelPB := vumeter.NewVUMeterWithData(level)
|
|
level.Set(0.95)
|
|
levelPB.TextFormatter = func() string { return " " }
|
|
progress := widget.NewProgressBarWithData(level)
|
|
setLevel := binding.NewFloat()
|
|
setLevel.Set(75.0)
|
|
slider := widget.NewSliderWithData(0.0, 100.0, setLevel)
|
|
slider.OnChanged = func(data float64) {
|
|
level.Set(data / 100)
|
|
}
|
|
|
|
w.SetContent(container.New(layout.NewVBoxLayout(), levelPB, progress, slider))
|
|
w.ShowAndRun()
|
|
}
|