mirror of
https://github.com/mappu/miqt.git
synced 2025-01-08 16:38:37 +00:00
goroutine6: use mainthread.Wait() helper function
This commit is contained in:
parent
f71dc1c303
commit
e347084d94
@ -7,6 +7,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
qt "github.com/mappu/miqt/qt6"
|
qt "github.com/mappu/miqt/qt6"
|
||||||
|
"github.com/mappu/miqt/qt6/mainthread"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -39,8 +40,11 @@ func main() {
|
|||||||
var tick int
|
var tick int
|
||||||
for range time.NewTicker(time.Duration((index+1)*25) * time.Millisecond).C {
|
for range time.NewTicker(time.Duration((index+1)*25) * time.Millisecond).C {
|
||||||
tick++
|
tick++
|
||||||
time.Sleep(50 * time.Millisecond)
|
// time.Sleep(50 * time.Millisecond)
|
||||||
qlabel.SetText(fmt.Sprintf("%v %v", tick, time.Now().UTC().Format("15:04:05.0000")))
|
|
||||||
|
mainthread.Wait(func() {
|
||||||
|
qlabel.SetText(fmt.Sprintf("%v %v", tick, time.Now().UTC().Format("15:04:05.0000")))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}(i, label)
|
}(i, label)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user