NHacker Next
  • new
  • past
  • show
  • ask
  • show
  • jobs
  • submit
PyWry: Cross-Platform Rendering Engine in Python (deeleeramone.github.io)
simonw 2 days 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/092386c894d3a0deb2572f3155552...
th0ma5 1 days ago [-]
[dead]
simonw 1 days ago [-]
I had a poke around in the wheel and it looks like a lot of the heavy lifting is done by this 30.8MB binary file:

pywry/_vendor/pytauri_wheel/ext_mod.cpython-310-darwin.so

Looks like that's vendored from this project: https://github.com/pytauri/pytauri

IshKebab 1 days ago [-]
It's Electron! (Basically; I know it technically isn't.)

If you're going to use Tauri I dunno why you wouldn't just use Typescript. Why bring Python into things?

simonw 1 days ago [-]
Because you like working Python more than typescript, and/or there are existing Python libraries you want to use that have no good typescript equivalent.
JBorrow 1 days ago [-]
This cross platform rendering engine’s website doesn’t render well at all on Safari on the iPhone.
Twirrim 1 days ago [-]
Same on chrome and Firefox on an android device
Oras 1 days ago [-]
Neither on mobile chrome
swiftcoder 2 days ago [-]
Maybe I'm an old fart, but "rendering engine" used to mean 3D graphics. This is actually a cross-platform UI toolkit? Or rather a web toolkit than can be deployed to desktop via Tauri?
yunruse 1 days ago [-]
I thought so too at first. It is definitely something interfaced on top of Tauri[0] with some sort of 'server-side logic' framework[1]. But looking at Tauri's site, it is really hard to disentangle if PyWry is a binder about WRY[2] or not.

"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

swiftcoder 22 hours ago [-]
> Tauri is akin to Chromium, I think?

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.

tuvix 1 days ago [-]
You’re not alone I was assuming it was 3D graphics as well. Disappointed to see, according to other comments, it’s a wrapper around python bindings to Tauri
rirze 1 days ago [-]
This feels like a Rube-Goldberg kind of integration. I would love to know if there's an actual use for this opinionated stack, because I would've never guessed it.
nycdatasci 2 days ago [-]
Interesting project. The examples page needs screenshots.
wisemanwillhear 1 days ago [-]
Interesting, I've been using Flet for my projects lately, and I've been very happy for desktop environments. Never tried it on web and phone platforms, but Flet has similar run-everywhere marketing which originally drew me in. Anyone know how PyWry differs from Flet?
jmague 1 days ago [-]
This cross platform rendering engine’s website doesn’t render well at all on Chrome on Android
firebot 1 days ago [-]
Site is rendered extremely poorly on Firefox Mobile.
Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact
Rendered at 04:26:59 GMT+0000 (Coordinated Universal Time) with Vercel.