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/092386c894d3a0deb2572f3155552...pywry/_vendor/pytauri_wheel/ext_mod.cpython-310-darwin.so
Looks like that's vendored from this project: https://github.com/pytauri/pytauri
If you're going to use Tauri I dunno why you wouldn't just use Typescript. Why bring Python into things?
"OS-efficient cross-platform HTML-based UI toolkit" is a great technological thing, but neither PyWry and Tauri's sites make that clear, or meaningfully advertise what they do. Which is a shame, because there is myriad software which might benefit all to use this.
[0] Tauri is akin to Chromium, I think? https://tauri.app
[1] and also a rather large amount of LLM integration; the source for PyWry has a whole section for Claude bindings
[2] the Webview Rendering librarY (WRY) used in Tauri https://github.com/tauri-apps/wry
Yeah, Tauri is for shipping web apps as desktop apps - basically an Electron replacement. Its main selling point is that it uses the system web view on Mac/Windows, so it doesn't have to bundle most of Chromium with every app.