logoalt Hacker News

PyWry: Cross-Platform Rendering Engine in Python

26 pointsby filipovicyesterday at 10:42 AM10 commentsview on HN

Comments

simonwtoday at 4:21 PM

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...
show 1 reply
JBorrowtoday at 6:50 PM

This cross platform rendering engine’s website doesn’t render well at all on Safari on the iPhone.

jmaguetoday at 7:01 PM

This cross platform rendering engine’s website doesn’t render well at all on Chrome on Android

wisemanwillheartoday at 6:38 PM

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?

swiftcodertoday at 4:22 PM

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?

show 2 replies
rirzetoday at 5:40 PM

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.

simonwtoday at 4:29 PM

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

nycdatascitoday at 4:07 PM

Interesting project. The examples page needs screenshots.

firebottoday at 6:17 PM

Site is rendered extremely poorly on Firefox Mobile.