mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-19 18:27:29 -05:00
[next] Cumulative pre-release patches (#1682)
This commit is contained in:
committed by
GitHub
parent
d56eeb59ed
commit
0696e4682d
29
pyscript.core/test/click.html
Normal file
29
pyscript.core/test/click.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>PyScript Next Plugin Bug?</title>
|
||||
<link rel="stylesheet" href="../dist/core.css">
|
||||
<script type="module" src="../dist/core.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="py">
|
||||
from pyscript import display, document
|
||||
from datetime import datetime as dt
|
||||
from pyodide.ffi.wrappers import add_event_listener
|
||||
|
||||
element = document.querySelector("#just-a-button")
|
||||
|
||||
def on_click(event):
|
||||
print(f"Hello from Python! {dt.now()}")
|
||||
display(f"Hello from Python! {dt.now()}", append=False, target='eresult')
|
||||
|
||||
add_event_listener(element, "click", on_click)
|
||||
</script>
|
||||
|
||||
<button id="just-a-button">click and check the console</button>
|
||||
|
||||
<div id="result"></div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user