Fyne gui api fahrenheit-convertor howto callback/event handler

I want to create a celcius-fahrenheit convertor using the gui toolkit fyne.
On enter of an entry i want to change the text of a label, ie the celcius converted to fahrenheit.
How do i do callbacks or handle enter events of the entry ?
More concrete an eventhandler on pressing enter of the entry widget.

Here is the code for a converter *3, one should use “bindings”

package main

import (


func makeUI() fyne.CanvasObject {
	estring := ""
	myentrystring := binding.BindString(&estring)
	mylabelstring := binding.NewString()
	myentry := widget.NewEntryWithData(myentrystring)
	mylabel := widget.NewLabelWithData(mylabelstring)
	mybutton := widget.NewButton("Convert",
		func() {
			myinput, _ := strconv.Atoi(estring)
			myinput = myinput * 3
			myoutput := strconv.Itoa(myinput)
	return container.NewVBox(myentry, mybutton, mylabel)

func main() {
	a := app.New()
	w := a.NewWindow("Widget Binding")


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.