File tree 5 files changed +6
-6
lines changed 5 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 23
23
< h1 > Bokeh Example</ h1 >
24
24
< div id ="myplot "> </ div >
25
25
26
- < py-script >
26
+
10000
< py-script id =" mycode " >
27
27
import json
28
28
import pyodide
29
29
Original file line number Diff line number Diff line change 23
23
< h1 > Bokeh Example</ h1 >
24
24
< div id ="myplot "> </ div >
25
25
26
- < py-script >
26
+ < py-script id =" my " >
27
27
import asyncio
28
28
import json
29
29
import pyodide
Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ export class PyRepl extends BaseEvalElement {
188
188
this . errorElement = this . outputElement ;
189
189
}
190
190
}
191
-
191
+
192
192
193
193
this . appendChild ( mainDiv ) ;
194
194
this . editor . focus ( ) ;
Original file line number Diff line number Diff line change @@ -247,7 +247,7 @@ export class PyScript extends BaseEvalElement {
247
247
}
248
248
249
249
getSourceFromElement ( ) : string {
250
- return this . code ;
250
+ return htmlDecode ( this . code ) ;
251
251
}
252
252
}
253
253
Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ class PyScript:
22
22
if append:
23
23
child = document.createElement('div');
24
24
element = document.querySelector(f'#{element_id}');
25
+ if not element:
26
+ return
25
27
exec_id = exec_id or element.childElementCount + 1
26
28
element_id = child.id = f"{element_id}-{exec_id}";
27
29
element.appendChild(child);
@@ -34,11 +36,9 @@ class PyScript:
34
36
img_str = 'data:image/png;base64,' + base64.b64encode(buf.read()).decode('UTF-8')
35
37
document.getElementById(element_id).innerHTML = f'<div><img id="plt" src="{img_str}"/></div>'
36
38
elif hasattr(value, "startswith") and value.startswith("data:image"):
37
- console.log(f"DATA/IMAGE: {value}")
38
39
document.getElementById(element_id).innerHTML = f'<div><img id="plt" src="{value}"/></div>'
39
40
else:
40
41
document.getElementById(element_id).innerHTML = value;
41
- console.log(f"ELSE: {append} ==> {element_id} --> {value}")
42
42
43
43
@staticmethod
44
44
def run_until_complete(f):
You can’t perform that action at this time.
0 commit comments