1
0
mirror of https://github.com/pyscript/pyscript.git synced 2022-05-01 19:47:48 +03:00

update examples to show loading modules into the environment

This commit is contained in:
Fabio Pliger
2022-04-12 19:04:53 -05:00
parent 67be46f224
commit 92613c06f5
4 changed files with 27 additions and 10 deletions

View File

@@ -10,6 +10,10 @@
<link rel="stylesheet" href="../build/pyscript.css" />
<script defer src="../build/pyscript.js"></script>
<py-env>
- paths:
- /utils.py
</py-env>
</head>
<body>
@@ -17,20 +21,18 @@
<div id="outputDiv2" class="font-mono"></div>
<div id="outputDiv3" class="font-mono"></div>
<py-script target="outputDiv">
from datetime import datetime
now = datetime.now()
now.strftime("%m/%d/%Y, %H:%M:%S")
import utils
utils.now()
</py-script>
<py-script>
from datetime import datetime
from utils import now
import asyncio
async def foo():
while True:
await asyncio.sleep(1)
now = datetime.now()
output = now.strftime("%m/%d/%Y, %H:%M:%S")
output = now()
pyscript.write("outputDiv2", output)
out3 = Element("outputDiv3")