diff --git a/assets/js/pypg.js b/assets/js/pypg.js new file mode 100644 index 0000000..09b1589 --- /dev/null +++ b/assets/js/pypg.js @@ -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("") +} diff --git a/python.html b/python.html index a0f1887..261fc4b 100644 --- a/python.html +++ b/python.html @@ -51,27 +51,6 @@ document['console'].html = '' - +