Closed Dev1lroot closed 4 years ago
This is a Nim question, nimx is nothing special in these regards. Please, read the nim manual, and/or ask around e.g. on the nim forum.
But generally you can't access same refs from different threads. I'd suggest messaging approach.
import os, nimx/window, nimx/text_field
var wnd = newWindow(newRect(40, 40, 800, 600)) let label = newLabel(newRect(20, 20, 150, 20)) wnd.addSubview(label)
proc mywhile() = var i = 0 while(true): label.text = $i i = i + 1 os.sleep(1000)
var th1: Thread[void]
createThread(th1, mywhile)
th1.joinThread()
proc main() = echo "just run, don't bother"
runApplication: main()
-_-