Skip to main content

Python bindings for Wry

Project description

Wry Py

Python bindings for Wry for building desktop apps with webviews.

Install

pip install wry_py

Linux needs GTK/WebKitGTK:

# Debian/Ubuntu
sudo apt install libgtk-3-dev libwebkit2gtk-4.1-dev

# Arch
sudo pacman -S gtk3 webkit2gtk-4.1

Quick Start

from wry_py import UiWindow, div, text, button

count = 0

def increment():
    global count
    count += 1
    render()

def render():
    root = (
        div()
        .size_full()
        .v_flex()
        .items_center()
        .justify_center()
        .gap(20)
        .child_builder(text(f"Count: {count}").text_size(32))
        .child_builder(
            button("Increment")
            .padding(10, 20)
            .bg("#3b82f6")
            .text_color("#fff")
            .on_click(increment)
        )
        .build()
    )
    window.set_root(root)

window = UiWindow(title="Counter", width=400, height=300)
render()
window.run()

Local assets

If your webview blocks file:// access, register binary assets (images, fonts) from Python using AssetCatalog and reference them with the asset: prefix when creating an image. This embeds the bytes as data: URIs so the webview can load them without filesystem permissions.

from wry_py import AssetCatalog, image

catalog = AssetCatalog()
with open("examples/local_image/assets/logo.png", "rb") as f:
    catalog.add("logo.png", f.read())

image("asset:logo.png").width(120).height(120)

Examples

# Counter
python -m examples.counter

# Todo list with dialogs
python -m examples.todo_list

# Hover, focus, and transitions
python -m examples.styles

# Partial updates (efficient UI updates)
python -m examples.partial_update

# Multi-step form with all form elements
python -m examples.form_demo

Development

git clone https://github.com/Jacob-Walton/wry_py.git
cd wry_py
pip install maturin
maturin develop --release

Docs

https://jacob-walton.github.io/wry_py/

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wry_py-0.2.0.tar.gz (39.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

wry_py-0.2.0-cp314-cp314-win_amd64.whl (618.0 kB view details)

Uploaded CPython 3.14Windows x86-64

wry_py-0.2.0-cp314-cp314-win32.whl (566.1 kB view details)

Uploaded CPython 3.14Windows x86

wry_py-0.2.0-cp314-cp314-macosx_11_0_arm64.whl (864.8 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

wry_py-0.2.0-cp314-cp314-macosx_10_12_x86_64.whl (886.4 kB view details)

Uploaded CPython 3.14macOS 10.12+ x86-64

wry_py-0.2.0-cp313-cp313-win_amd64.whl (628.7 kB view details)

Uploaded CPython 3.13Windows x86-64

wry_py-0.2.0-cp313-cp313-macosx_11_0_arm64.whl (872.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

wry_py-0.2.0-cp313-cp313-macosx_10_12_x86_64.whl (900.1 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

wry_py-0.2.0-cp312-cp312-win_amd64.whl (629.2 kB view details)

Uploaded CPython 3.12Windows x86-64

wry_py-0.2.0-cp312-cp312-macosx_11_0_arm64.whl (873.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

wry_py-0.2.0-cp312-cp312-macosx_10_12_x86_64.whl (900.4 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

wry_py-0.2.0-cp311-cp311-win_amd64.whl (629.5 kB view details)

Uploaded CPython 3.11Windows x86-64

wry_py-0.2.0-cp311-cp311-macosx_11_0_arm64.whl (874.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

wry_py-0.2.0-cp311-cp311-macosx_10_12_x86_64.whl (901.5 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

wry_py-0.2.0-cp310-cp310-win_amd64.whl (629.4 kB view details)

Uploaded CPython 3.10Windows x86-64

File details

Details for the file wry_py-0.2.0.tar.gz.

File metadata

  • Download URL: wry_py-0.2.0.tar.gz
  • Upload date:
  • Size: 39.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.10.2

File hashes

Hashes for wry_py-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3b6e861b653a63ae77796cefcb8f2e500b60ee565b6adea7118a9bbfe0966aac
MD5 66825af792f1bfdde20f5aa0d2ec253a
BLAKE2b-256 c91bcd38d3779e6a778d78afd3802f35d4ef9fa4e388e79a624649b8c49def92

See more details on using hashes here.

File details

Details for the file wry_py-0.2.0-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: wry_py-0.2.0-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 618.0 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.10.2

File hashes

Hashes for wry_py-0.2.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 267de38d92a89cfc7e8a34971244a13bf9da148d8bc09b1294acb86144466369
MD5 24ab69fc972c44778748ece8eec3aa07
BLAKE2b-256 4664f7585830ae37298c00d1df38dd30322efb4f9dee1ffd4f8029501dcce18b

See more details on using hashes here.

File details

Details for the file wry_py-0.2.0-cp314-cp314-win32.whl.

File metadata

  • Download URL: wry_py-0.2.0-cp314-cp314-win32.whl
  • Upload date:
  • Size: 566.1 kB
  • Tags: CPython 3.14, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.10.2

File hashes

Hashes for wry_py-0.2.0-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 9e37d8f5d086930970a02c6fbec0aebe55cdd9e5854058ebce1df5f81bd3c105
MD5 ed64f3076baf9208bc04d4e3599422c5
BLAKE2b-256 8a90b56ac8bf1c694e707b4f09a3bc7bbcd3930cbd5aeeab83129d4691de4cd8

See more details on using hashes here.

File details

Details for the file wry_py-0.2.0-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for wry_py-0.2.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5f78cbf57f7438dee3dc2de3f71b5a6f77957ca85a7a4b1d96d433921cdab1d2
MD5 2466e73dce7c17129c2090ba0a2ed045
BLAKE2b-256 aacf9c23908c6bf372b6a5261665d592a39602092936bfed42edaee2a89d90d7

See more details on using hashes here.

File details

Details for the file wry_py-0.2.0-cp314-cp314-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for wry_py-0.2.0-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 151c968b7abba1f229fe407de857c632b1865d96e6a5429d93ef74d85a2a8c94
MD5 9d09e99f191280140177249c875b8c0c
BLAKE2b-256 04275348953225067cf3206311a75ee9588ad7972b610001d6be405d9c5e3317

See more details on using hashes here.

File details

Details for the file wry_py-0.2.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: wry_py-0.2.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 628.7 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.10.2

File hashes

Hashes for wry_py-0.2.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 820644cde5ca1ca570a6229eca3805f2428f489a5a7790b9924999c1869213de
MD5 f2f893c55898c964ae9d9d75d317d676
BLAKE2b-256 20a274e5dcac50902a853ab0c99899c6c9b5e671e744dadd2026371089775119

See more details on using hashes here.

File details

Details for the file wry_py-0.2.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for wry_py-0.2.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dd3c9986517dbd5e543749dfd23b794aa27447c852f20c4fea47cc2522baca08
MD5 f2cb6512eea27bf844bd99b45491c3b5
BLAKE2b-256 5d8f2ca8f42ffda923927a31440225ca176a468fadc8335c83bff3e3ebf79a77

See more details on using hashes here.

File details

Details for the file wry_py-0.2.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for wry_py-0.2.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 aa80632129172d1dfa108e18a252839d8055851db7b6f62067298ffe13689fa7
MD5 9dab6c62e67947bba1489485a9027ead
BLAKE2b-256 8ba6dc040807b8785724f6c01c190e20125b3a39855c45475b6e0f49a69ec51f

See more details on using hashes here.

File details

Details for the file wry_py-0.2.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: wry_py-0.2.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 629.2 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.10.2

File hashes

Hashes for wry_py-0.2.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b745ca746663b40338b1acb5474ddb71e38061063dac0611a810559773bdd7b0
MD5 5b0034a4d389a3b1b42cf101a3f9b050
BLAKE2b-256 4e2cb609d4fb6e9a4814cc1ef4eab4091aadf77eefafeb626819df1488a22a44

See more details on using hashes here.

File details

Details for the file wry_py-0.2.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for wry_py-0.2.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 def263083f6904af71ad8fcc0e33f55fcdacf59eabedd4880b3a6b995d9e2cdb
MD5 d70455f6ddaf042e2431f35a12a8bc94
BLAKE2b-256 34ac18cbb6193d320d9f03be695e0cf6f53e303b7f846b861a007acbcbf3b1df

See more details on using hashes here.

File details

Details for the file wry_py-0.2.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for wry_py-0.2.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 42b57332d3fb487d4ab53c430dc92ea6c09ed769ccd9c123ff8bed7387ba349e
MD5 8ba1675e2e8e25a9497cfcc08deadbcd
BLAKE2b-256 7ca64ce16a57edb3a731e879bb11a3f305f43ca7833a96ed284bad701bb37c9e

See more details on using hashes here.

File details

Details for the file wry_py-0.2.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: wry_py-0.2.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 629.5 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.10.2

File hashes

Hashes for wry_py-0.2.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0fc90c0fde75b9ed5b6647b8a720ccc1b63c0c25635a6551670f0b759f5d8b64
MD5 0737450ebd2449ac39e113be72c0d119
BLAKE2b-256 1fb019ca4c6c2da02fc8e64b669e3e252ef5bf2571a6f0da629a2129c9179401

See more details on using hashes here.

File details

Details for the file wry_py-0.2.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for wry_py-0.2.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bc93e9a36af35d2fa022f445273d691ad9c271f641a0339469b4791190ed2d07
MD5 646f70618fd4bf7627008668f15bbd35
BLAKE2b-256 510294ebca893661007a04848a0fb0e341f707a8e84c69e9d9998685b5656dbe

See more details on using hashes here.

File details

Details for the file wry_py-0.2.0-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for wry_py-0.2.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 82d34ae5f8d7f64f248c0ca7187cfda1b079db96c87c952a4f20282c07cbcfa3
MD5 6164ce5e754d24e87e3bc42a077f6ace
BLAKE2b-256 822b65e4f65c272d7edc560138fc4b831df99733af69b473002fea9b9a412787

See more details on using hashes here.

File details

Details for the file wry_py-0.2.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: wry_py-0.2.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 629.4 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.10.2

File hashes

Hashes for wry_py-0.2.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 831b14a53825ca6f61842397d16260afc48d0a97ed6f4fecb4f6dabd3a855425
MD5 020ccc475542e3b310ad459a4da561c3
BLAKE2b-256 9bf31ec96f60f5437c9c6fff9f1306dc74f289f0e46a48015d803a2c5888ecab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page