3 ms·
One-liner with uv to try this out: uv run --with pywry python <<'EOF' app = PyWry() def on_button_click(data, event_type, label): """Called when
by simonw 6mo ago
One-liner with uv to try this out:
uv run --with pywry python <<'EOF'
app = PyWry()
def on_button_click(data, event_type, label):
"""Called when the button is clicked."""
app.emit("pywry:set-content", {"id": "greeting", "text": "Button was clicked!"}, label)
html = """
<div style="padding: 20px; text-align: center;">
<h1 id="greeting">Click the button below</h1>
<button onclick="window.pywry.emit('app:button-click', {time: Date.now()})">
Click me!
</button>
</div>
"""
app.show(
html,
callbacks={"app:button-click": on_button_click},
)
app.block()
EOF
Looks promising. Here's a screenshot: https://gist.github.com/simonw/092386c894d3a0deb2572f3155552183?permalink_comment_id=6123288#gistcomment-6123288 https://gist.github.com/simonw/092386c894d3a0deb2572f3155552...
- th0ma5 6mo ago[dead]