-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheditorExample.html
More file actions
39 lines (29 loc) · 1003 Bytes
/
Copy patheditorExample.html
File metadata and controls
39 lines (29 loc) · 1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Live Editor Mode in PyScrpt</title>
<link rel="stylesheet" href="https://pyscript.net/releases/2024.8.2/core.css">
<script type="module" src="https://pyscript.net/releases/2024.8.2/core.js"></script>
</head>
<body>
<!--
The following example demonstrates live editor feature in PyScript.
Things to note:
1. To use live editor we need to add attribute: type="py-editor".
-->
<div id="editor"></div>
<script type="py-editor" target="editor">
# Text inside the live editor is pre-populated
for i in range(5):
print(i)
</script>
<script type="py-editor" target="editor">
# Text inside the live editor is pre-populated
def doThis(n):
return n+2
print(doThis(100))
</script>
</body>
</html>