Files
pyscript/pyscript.core/tests/manual/click.html
Andrea Giammarchi 9f46234f71 Fix #2114 - Cleanup the test folder + automation (#2143)
* Fix #2114 - Cleanup the test folder + automation
* Merged both test and tests into a single folder
2024-08-08 17:08:59 +02:00

30 lines
849 B
HTML

<!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='result')
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>