Python js in dedicated file
This commit is contained in:
parent
743753ee5d
commit
1daeeb6873
|
@ -0,0 +1,20 @@
|
||||||
|
const flask = getEditor("#code", "py")
|
||||||
|
|
||||||
|
brython({ids:["pyinit"]})
|
||||||
|
|
||||||
|
function run() {
|
||||||
|
document.getElementById("pycode").innerHTML = flask.getCode()
|
||||||
|
brython({ids:["pyclear"]})
|
||||||
|
brython({
|
||||||
|
debug:1,
|
||||||
|
ids:["pycode"]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function example() {
|
||||||
|
flask.updateCode("def foo(n):\n for i in range(n):\n print('passe ' + str(i))\n return n*n\n\nprint(foo(5))")
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearCode() {
|
||||||
|
flask.updateCode("")
|
||||||
|
}
|
23
python.html
23
python.html
|
@ -51,27 +51,6 @@ document['console'].html = ''
|
||||||
</script>
|
</script>
|
||||||
<script type="text/python" id="pycode"></script>
|
<script type="text/python" id="pycode"></script>
|
||||||
<script src="assets/js/editor.js"></script>
|
<script src="assets/js/editor.js"></script>
|
||||||
<script>
|
<script src="assets/js/pypg.js"></script>
|
||||||
const flask = getEditor("#code", "py")
|
|
||||||
|
|
||||||
brython({ids:["pyinit"]})
|
|
||||||
|
|
||||||
function run() {
|
|
||||||
document.getElementById("pycode").innerHTML = flask.getCode()
|
|
||||||
brython({ids:["pyclear"]})
|
|
||||||
brython({
|
|
||||||
debug:1,
|
|
||||||
ids:["pycode"]
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function example() {
|
|
||||||
flask.updateCode("def foo(n):\n for i in range(n):\n print('passe ' + str(i))\n return n*n\n\nprint(foo(5))")
|
|
||||||
}
|
|
||||||
|
|
||||||
function clearCode() {
|
|
||||||
flask.updateCode("")
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue