Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cb00566

Browse files
committed
improve and explain the 'script 2' demo
1 parent 4d2e740 commit cb00566

File tree

1 file changed

+34
-8
lines changed

1 file changed

+34
-8
lines changed

pyscriptjs/examples/simple_script2.html

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,48 @@
44
<meta charset="utf-8" />
55
<meta name="viewport" content="width=device-width,initial-scale=1" />
66

7-
<title>Svelte app</title>
7+
<title>PyScript simple script 2 demo</title>
88

99
<link rel="icon" type="image/png" href="favicon.png" />
10-
<link rel="stylesheet" href="../build/pyscript.css" />
11-
10+
<!-- <link rel="stylesheet" href="../build/pyscript.css" /> -->
1211
<script defer src="../build/pyscript.js"></script>
1312
<py-env>
14-
- paths:
15-
- /utils.py
13+
- paths:
14+
- /utils.py
1615
</py-env>
1716
</head>
1817

1918
<body>
20-
<div class="font-mono">start time: <label id="outputDiv"></label></div>
21-
<div id="outputDiv2" class="font-mono"></div>
22-
<div id="outputDiv3" class="font-mono"></div>
19+
<p>This example demonstrates various features:
20+
<ul class="list-disc">
21+
<li>
22+
<i>Start time</i> is computed as soon as the page is loaded,
23+
and it's placed into an HTML tag by using <tt>&lt;py-script output="outputDiv"&gt;</tt>.
24+
</li>
25+
26+
<li>
27+
<i>Current time</i> is computed every second,
28+
using <tt>asyncio</tt>. The HTML tag is modified by using
29+
the <tt>Element</tt> class.
30+
</li>
31+
</ul>
32+
</p>
33+
34+
<table>
35+
<tr>
36+
<th>Start time</th>
37+
<td id="outputDiv"></td>
38+
</tr>
39+
<tr>
40+
<th>Current time</th>
41+
<td id="outputDiv2"></td>
42+
</tr>
43+
<tr>
44+
<th>&nbsp;</th>
45+
<td id="outputDiv3"></td>
46+
</tr>
47+
</table>
48+
2349
<py-script output="outputDiv">
2450
import utils
2551
utils.now()

0 commit comments

Comments
 (0)