mirror of
https://github.com/pyscript/pyscript.git
synced 2026-02-21 20:00:44 -05:00
46 lines
1.3 KiB
HTML
46 lines
1.3 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
|
|
<title>python events</title>
|
|
<link rel="stylesheet" href="style.css" />
|
|
<script defer src="./counter.js"></script>
|
|
<script type="module" src="../core.js"></script>
|
|
</head>
|
|
<body>
|
|
<script type="pyodide">
|
|
def print_version(event):
|
|
import sys
|
|
print(event.type)
|
|
print(sys.version)
|
|
|
|
class Printer:
|
|
def version(self, event):
|
|
print_version(event)
|
|
|
|
printer = Printer()
|
|
</script>
|
|
<button
|
|
pyodide-pointerdown="print_version"
|
|
pyodide-click="printer.version"
|
|
>
|
|
pyodide version
|
|
</button>
|
|
|
|
<script type="micropython">
|
|
def print_version(event):
|
|
import sys
|
|
print(event.type)
|
|
print(sys.version)
|
|
</script>
|
|
<!-- ⚠️ MicroPython bug: it fails the printer.version case -->
|
|
<button
|
|
micropython-pointerdown="print_version"
|
|
micropython-click="printer.version"
|
|
>
|
|
micropython version
|
|
</button>
|
|
</body>
|
|
</html>
|