There really isn't a great way to do this by default. I suppose you could write some pretty barbaric sleep()-based timing system to manage all the tasks, but that is neither elegant nor efficient.
Asynchronous event driven programming works <3
Imagine writing a GUI application where you couldn't refresh an animated object AND click a button at the same time.
Most GUI API's (IE: QT, GTK) are event driven. However, yes you're right most of them sit on a very tiny thread pool (typically 2-3 threads that are constantly re-used and repurposed because thread allocation is expensive)
You can also view javascript as a GUI centric frontend language that itself is event driven and asynchronous. However, javascript famously only uses a single thread for it's event loop
Out of browser implementations of javascript (node.js) allow you to create desktop GUI api's in pure javascript using GTK
https://github.com/niklasf/node-ui-gtk/ ... counter.js.
"If art interprets our dreams, the computer executes them in the guise of programs!" - SICP

“If at first, the idea is not absurd, then there is no hope for it” - Albert Einstein