mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-19 18:27:29 -05:00
* Fix #1998 - Allow lazy PyTerminal bootstrap * Fix #1998 - Allow lazy terminal bootstrap / runtime * Implemented mpy terminal in both main and worker * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
37 lines
1.2 KiB
HTML
37 lines
1.2 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>PyTerminal</title>
|
|
<link rel="stylesheet" href="../dist/core.css">
|
|
<script type="module" src="../dist/core.js"></script>
|
|
<style>.xterm { padding: .5rem; }</style>
|
|
</head>
|
|
<body>
|
|
<script type="py">
|
|
def greetings(event):
|
|
print('hello world')
|
|
</script>
|
|
<script type="mpy" worker terminal>
|
|
# works on both worker and main scripts
|
|
print("__terminal__", __terminal__)
|
|
|
|
import sys
|
|
from pyscript import display, document
|
|
display("Hello", "PyScript Next - PyTerminal", append=False)
|
|
print("this should go to the terminal")
|
|
print("another line")
|
|
|
|
# this works as expected
|
|
print("this goes to stderr", file=sys.stderr)
|
|
document.addEventListener('click', lambda event: print(event.type))
|
|
|
|
# this works on MicroPython too
|
|
import code
|
|
code.interact()
|
|
</script>
|
|
<button id="my-button" py-click="greetings">Click me</button>
|
|
</body>
|
|
</html>
|