8000 Merge pull request #12 from anaconda/pys-16/improve-examples-ref · rmyers/pyscript@1966f1c · GitHub
[go: up one dir, main page]

Skip to content

Commit 1966f1c

Browse files
authored
Merge pull request pyscript#12 from anaconda/pys-16/improve-examples-ref
fix examples landing page and some import issues
2 parents 6292341 + c29144d commit 1966f1c

File tree

6 files changed

+43
-20
lines changed

6 files changed

+43
-20
lines changed

pyscriptjs/examples/index.html

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,49 @@
77
<title>PyScript demo</title>
88

99
<link rel="icon" type="image/png" href="favicon.png" />
10-
<link rel="stylesheet" href="build/bundle.css" />
11-
12-
<script defer src="build/bundle.js"></script>
10+
<link rel="stylesheet" href="build/pyscript.css" />
1311
</head>
1412

15-
<body class="container">
13+
<body class="container font-mono">
1614

1715
<h1 class="text-3xl font-bold">PyScript demos</h1>
1816
<hr/>
1917

20-
<h2 class="text-2xl font-bold text-blue-600"><a href="./simple_script.html">Simple script</a></h2>
21-
<p>A static demo of the <code>&lt;py-script&gt;</code> tag</p>
18+
<h2 class="text-2xl font-bold text-blue-600"><a href="./bokeh_interactive.html" target=”_blank”>Bokeh Interactive</a></h2>
19+
<p>Interactive demo using a Bokeh slider widget to dynamically change a value in the page
2220

23-
<h2 class="text-2xl font-bold text-blue-600"><a href="./simple_script2.html">Simple script 2</a></h2>
24-
<p>A dynamic demo of the <code>&lt;py-script&gt;</code> tag</p>
21+
WARNING: This examples takes a little longer to load. So be patient :)
22+
</p>
2523

26-
<h2 class="text-2xl font-bold text-blue-600"><a href="./repl.html">REPL</a></h2>
27-
<p>A Python REPL (Read Eval Print Loop). </p>
24+
<h2 class="text-2xl font-bold text-blue-600"><a href="./bokeh.html" target=”_blank”>Simple Static Bokeh Plot</a></h2>
25+
<p>Minimal Bokeh demo demonstrating how to create a simple bokeh plot from code</p>
26+
27+
<h2 class="text-2xl font-bold text-blue-600"><a href="./panel_kmeans.html" target=”_blank”>KMeans Demo in Panel</a></h2>
28+
<p>Interactive KMeans Chart using Panel
29+
30+
WARNING: This examples takes a little longer to load. So be patient :)
31+
</p>
32+
33+
<h2 class="text-2xl font-bold text-blue-600"><a href="./panel.html" target=”_blank”>Simple Panel Demo</a></h2>
34+
<p>Simple demo showing Panel widgets interating with parts of the page
2835

29-
<h2 class="text-2xl font-bold text-blue-600"><a href="./repl2.html">REPL2</a></h2>
36+
WARNING: This examples takes a little longer to load. So be patient :)
37+
</p>
38+
39+
40+
<h2 class="text-2xl font-bold text-blue-600"><a href="./repl.html" target=”_blank”>REPL</a></h2>
41+
<p>A Python REPL (Read Eval Print Loop). </p>
42+
43+
<h2 class="text-2xl font-bold text-blue-600"><a href="./repl2.html" target=”_blank”>REPL2</a></h2>
3044
<p>A Python REPL (Read Eval Print Loop) with slightly better formatting.</p>
45+
46+
<h2 class="text-2xl font-bold text-blue-600"><a href="./simple_script.html" target=”_blank”>Simple script</a></h2>
47+
<p>A static demo of the <code>&lt;py-script&gt;</code> tag</p>
48+
49+
<h2 class="text-2xl font-bold text-blue-600"><a href="./simple_script2.html" target=”_blank”>Simple script 2</a></h2>
50+
<p>A dynamic demo of the <code>&lt;py-script&gt;</code> tag</p>
51+
52+
<h2 class="text-2xl font-bold text-blue-600"><a href="./todo.html" target=”_blank”>TODO App</a></h2>
53+
<p>Demo showing how would a Simple TODO App would look like in PyScript</code> tag</p>
3154
</body>
32-
</html>
55+
</html>

pyscriptjs/examples/repl.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<title>Svelte app</title>
88

99
<link rel="icon" type="image/png" href="favicon.png" />
10-
<link rel="stylesheet" href="../build/bundle.css" />
10+
<link rel="stylesheet" href="../build/pyscript.css" />
1111

1212
<script defer src="../build/pyscript.js"></script>
1313
</head>

pyscriptjs/examples/repl2.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<title>Svelte app</title>
88

99
<link rel="icon" type="image/png" href="favicon.png" />
10-
<link rel="stylesheet" href="../build/bundle.css" />
10+
<link rel="stylesheet" href="../build/pyscript.css" />
1111

1212
<script defer src="../build/pyscript.js"></script>
1313
</head>

pyscriptjs/examples/simple_script.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</head>
1414

1515
<body>
16-
<div id="outputDiv" style="background-color:yellow"></div>
16+
<div id="outputDiv" class="font-mono" style="background-color:yellow"></div>
1717
<py-script target="outputDiv">
1818
from datetime import datetime
1919
now = datetime.now()

pyscriptjs/examples/simple_script2.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
<title>Svelte app</title>
88

99
<link rel="icon" type="image/png" href="favicon.png" />
10-
<link rel="stylesheet" href="../build/bundle.css" />
10+
<link rel="stylesheet" href="../build/pyscript.css" />
1111

1212
<script defer src="../build/pyscript.js"></script>
1313
</head>
1414

1515
<body>
16-
<div id="outputDiv"></div>
17-
<div id="outputDiv2" style="background-color: blueviolet"></div>
18-
<div id="outputDiv3" style="background-color: yellow"></div>
16+
<div class="font-mono">start time: <label id="outputDiv"></label></div>
17+
<div id="outputDiv2" class="font-mono"></div>
18+
<div id="outputDiv3" class="font-mono"></div>
1919
<py-script target="outputDiv">
2020
from datetime import datetime
2121
now = datetime.now()

pyscriptjs/src/interpreter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class PyScript:
3535
console.log(f"DATA/IMAGE: {value}")
3636
document.getElementById(element_id).innerHTML = f'<div><img id="plt" src="{value}"/></div>'
3737
else:
38-
document.getElementById(element_id).innerHTML = repr(value);
38+
document.getElementById(element_id).innerHTML = value;
3939
console.log(f"ELSE: {append} ==> {element_id} --> {value}")
4040
4141
@staticmethod

0 commit comments

Comments
 (0)
0