mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-19 18:27:29 -05:00
30 lines
844 B
HTML
30 lines
844 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='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>
|