mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-23 12:12:59 -05:00
Fix MicroPython terminal input when no REPL is used/needed (#2113)
* Fix terminal input when no REPL is used/needed * Fix input backspace too
This commit is contained in:
committed by
GitHub
parent
6f49f18937
commit
67d47511d5
@@ -9,7 +9,7 @@
|
||||
<style>.xterm { padding: .5rem; }</style>
|
||||
</head>
|
||||
<body>
|
||||
<script type="py" worker terminal>
|
||||
<script type="mpy" worker terminal>
|
||||
from pyscript import document
|
||||
document.documentElement.classList.add("first")
|
||||
|
||||
|
||||
18
pyscript.core/test/py-terminals/index.html
Normal file
18
pyscript.core/test/py-terminals/index.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="./no-repl.html">Prompt: NO REPL</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="./repl.html">Prompt: REPL</a>
|
||||
</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
20
pyscript.core/test/py-terminals/no-repl.html
Normal file
20
pyscript.core/test/py-terminals/no-repl.html
Normal file
@@ -0,0 +1,20 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>PyTerminal Prompt: NO REPL</title>
|
||||
<script type="module" src="../../dist/core.js"></script>
|
||||
<style>.xterm { padding: .5rem; }</style>
|
||||
</head>
|
||||
<body>
|
||||
<script type="mpy" worker terminal>
|
||||
prompt = input("Say something: ")
|
||||
print("You said, ", prompt)
|
||||
</script>
|
||||
<script type="py" worker terminal>
|
||||
prompt = input("Say something: ")
|
||||
print("You said, ", prompt)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
28
pyscript.core/test/py-terminals/repl.html
Normal file
28
pyscript.core/test/py-terminals/repl.html
Normal file
@@ -0,0 +1,28 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>PyTerminal Prompt: REPL</title>
|
||||
<script type="module" src="../../dist/core.js"></script>
|
||||
<style>.xterm { padding: .5rem; }</style>
|
||||
</head>
|
||||
<body>
|
||||
<script type="mpy" worker terminal>
|
||||
import code
|
||||
code.interact()
|
||||
|
||||
prompt = input("Say something: ")
|
||||
print("You said, ", prompt)
|
||||
</script>
|
||||
<script type="py" worker terminal>
|
||||
import code
|
||||
code.interact()
|
||||
|
||||
# Pyodide won't execute this ... ever
|
||||
# this should be tested manually
|
||||
prompt = input("Say something: ")
|
||||
print("You said, ", prompt)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user