-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
On both Ubuntu 22.04 and Debian 11 running Go 1.19 from the binary installer, the goroutines.go fails to build:
# gtk-examples/goroutines
./goroutines.go:70:14: assignment mismatch: 2 variables but glib.IdleAdd returns 1 value
./goroutines.go:70:45: too many arguments in call to glib.IdleAdd
have (func(label *gtk.Label, text string) bool, *gtk.Label, string)
want (interface{})
./goroutines.go:76:13: assignment mismatch: 2 variables but glib.IdleAdd returns 1 value
./goroutines.go:76:47: too many arguments in call to glib.IdleAdd
have (func(str string), string)
want (interface{})
If fixed this by changing the anonymous goroutine as follows:
go func() {
for {
time.Sleep(time.Second)
s := fmt.Sprintf("Set a label %d time(s)!", nSets)
handle := glib.IdleAdd(func() bool {
return LabelSetTextIdle(topLabel, s)
})
log.Printf("IdleAdd() #1 handle=%T %v\n", handle, handle)
nSets++
s = fmt.Sprintf("Set a label %d time(s)!", nSets)
handle = glib.IdleAdd(func() bool {
bottomLabel.SetText(s)
return false
})
log.Printf("IdleAdd() #2 handle=%T %v\n", handle, handle)
nSets++
}
}()The returned value is a "SourceHandle"; I don't know that that is or means since I'm only just starting with Go/Gtk.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels