- paths: - ./utils.py - autoclose_loader: false - runtimes: - src: "https://cdn.jsdelivr.net/pyodide/v0.20.0/full/pyodide.js" name: pyodide-0.20 lang: python
start time:
# demonstrates how use the global PyScript pyscript_loader # to send operation log messages to it import utils utils.now() from utils import now import asyncio async def foo(): while True: await asyncio.sleep(1) output = now() pyscript.write("outputDiv2", output) out3 = Element("outputDiv3") if output[-1] in ["0", "4", "8"]: out3.write("It's espresso time!") else: out3.clear() # close the global PyScript pyscript_loader pyscript_loader.close() pyscript.run_until_complete(foo())