Time and window
Elapsed time, fixed steps, frame rate, the window and calls from other threads.
clock
clock
window
window
call_soon
call_soon(fn, *args)Queues fn(*args) to run on the main thread, at the start of the next frame.
This is the way for another thread (a network listener, a worker, a model) to touch the sketch: it is safe to call from any thread, and fn always runs on the main thread, so it may change the App’s state and call Kiln functions without a lock.
The frame loop runs the queue right after it polls the window’s events, before the frame’s scripted and input events and before update, so the order in a frame is: calls from other threads, input events, update, draw. Calls run in the order they were queued (the order each thread queued them in, when several threads queue at once). A call queued by a call that is running waits for the next frame, so a call that re-queues itself cannot hold a frame up. An exception in a call propagates out of the frame loop as one in update does, and ends the run. An empty queue costs the loop one truth test per frame.
Calls still queued when the App ends are dropped. Calls queued before kiln.run starts run in the first frame.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| fn | Callable[…, object] | The callable to run. | required |
| *args | object | Positional arguments for fn. |
() |
exit
exit()Asks the App to stop after the current frame.
The frame in progress finishes, then the loop ends and App.exit runs as usual. This shadows the builtin exit only inside the kiln namespace.
Raises
| Name | Type | Description |
|---|---|---|
| RuntimeError | No App is running. |