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.3.tar.gz (43.1 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.3-cp314-cp314-win_amd64.whl (621.9 kB view details)

Uploaded CPython 3.14Windows x86-64

wry_py-0.2.3-cp314-cp314-win32.whl (569.4 kB view details)

Uploaded CPython 3.14Windows x86

wry_py-0.2.3-cp314-cp314-macosx_11_0_arm64.whl (875.2 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

wry_py-0.2.3-cp314-cp314-macosx_10_12_x86_64.whl (896.5 kB view details)

Uploaded CPython 3.14macOS 10.12+ x86-64

wry_py-0.2.3-cp313-cp313-win_amd64.whl (632.4 kB view details)

Uploaded CPython 3.13Windows x86-64

wry_py-0.2.3-cp313-cp313-macosx_11_0_arm64.whl (881.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

wry_py-0.2.3-cp313-cp313-macosx_10_12_x86_64.whl (908.7 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

wry_py-0.2.3-cp312-cp312-win_amd64.whl (632.9 kB view details)

Uploaded CPython 3.12Windows x86-64

wry_py-0.2.3-cp312-cp312-macosx_11_0_arm64.whl (882.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

wry_py-0.2.3-cp312-cp312-macosx_10_12_x86_64.whl (908.9 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

wry_py-0.2.3-cp311-cp311-win_amd64.whl (631.5 kB view details)

Uploaded CPython 3.11Windows x86-64

wry_py-0.2.3-cp311-cp311-macosx_11_0_arm64.whl (882.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

wry_py-0.2.3-cp311-cp311-macosx_10_12_x86_64.whl (910.0 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

wry_py-0.2.3-cp310-cp310-win_amd64.whl (631.5 kB view details)

Uploaded CPython 3.10Windows x86-64

wry_py-0.2.3-cp39-cp39-win_amd64.whl (633.0 kB view details)

Uploaded CPython 3.9Windows x86-64

File details

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

File metadata

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

File hashes

Hashes for wry_py-0.2.3.tar.gz
Algorithm Hash digest
SHA256 8085c562ee84e04470ae931839b3be06da0f00801aa08c9627f3d2fafd192f19
MD5 18fecce1781b21765b3e40fba6c40c26
BLAKE2b-256 a788a2ac67f1c61e0c9ea38194877ee079e67a75635c556e51643707ddf7c44f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for wry_py-0.2.3-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 fcc95da69d44e62514c8a9c80d87a4442f2ed872d4667affd07fdcd97cc8ed8f
MD5 11c925f4915c3b1ac1639d3548a83f52
BLAKE2b-256 9be7cd29326b434ca0e9d22ed427f1582d58c9bacaf99fa454d7fdf692021bd2

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for wry_py-0.2.3-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 fbe77cc548368be7f22b9c17537d417e3d84672cd698c2310508caa6cd55fa95
MD5 926477e4bd8ef79f4a2ec2be6d0eee52
BLAKE2b-256 eb11de08c143cd36eac7c6a5113bcb77de03869d4355bb43182f69eec882220e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.2.3-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e0402cb30b44892b04d28a1b15b3a78f882c4fd1a21362c1adea410cd4d6b6a2
MD5 52e3bd561f0353aabcaf7b663da73559
BLAKE2b-256 999a0bedc1a416b171cf4d6923a633a6e4628da9a5663e29f4f354dca11748ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.2.3-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 36f670ec543e79a708f36d0525c05a083b4f1c1dfd69a2ee4ee3315764fe1fe3
MD5 95eb8ae18daa27e32e35920120592801
BLAKE2b-256 9ee6a8715bf91ee1529cdb6b35e833ce929d31625381cc041d0085710ae87e94

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for wry_py-0.2.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8d6ebac9932281f54421bf8faa4a6a27d8426a0370d68ce2fafab404af9363a6
MD5 fcfa07ceb5d1707b6571f298b2b25817
BLAKE2b-256 cf4887918554d8f6e204dd38c80e499e9d5fb435d509c315203d20c540cae6f6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.2.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b960b2753e4ad16e0255f5870ae870fe91a743715e535dd8c59fa985880734ea
MD5 68a1aaac4bbd150016d01d5d6c696c6f
BLAKE2b-256 1c896d55999505b705fd7c550380f4ba4babb4c08f6f2f954a441b79ee032ac9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.2.3-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 284f3894a148b1b78413b9fec52a15d1878ebf4fe4c9415096505961a4e7e4b6
MD5 7970b7b097d3457c920fad1deed5a1d5
BLAKE2b-256 a67214611bb49cb03c9d60a98e88174bbe825b48369f3c9763465644a22f1b5f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for wry_py-0.2.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5e736e19542577db83204d2c7fc48da2957d8ed67f186ffafb1285fe1a5437f5
MD5 2922e26e06c41ffc0039e7a599b2fb32
BLAKE2b-256 854e223a03894657e7e10563ba9fc1c25574cfe9c4f06b7fbeee9e544b9a3d92

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.2.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 91bd9995d25b5a6f2dda153103f5a181dfe62558a0d265f751d044db98af331b
MD5 ba001c6ac6a2b00b28ee93e53a561fd0
BLAKE2b-256 8a1288b774671a8d14c341a34daab7255dd1a0df75b1b306738a64b454fa4f06

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.2.3-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9476b329b7db136539063326fbda661950b314476f7a5af09bc98dc007f6fa66
MD5 aa5bffe9147df8bdff0683c87df61e4f
BLAKE2b-256 e50605e80b3000fa7728e97dfe45ed9e9e0f9d82dbc3e5fbf51eaf67ddd4e8c8

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for wry_py-0.2.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c20aa45a6b960b4775ad3f4067655e9c88891334aba6b3b0027f82eccafea74e
MD5 63753099ecc4ac9a8572a553ab08a66b
BLAKE2b-256 b02e69fe2a314c97b9ba34f35308ff470e45af7abb50f2978c851fee9200e5cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.2.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ce3c1230ff48064c7cbd64b66932ed978a56ef2a9b282d3fd4727cb97ecb6496
MD5 749a1e1cdd47294a3b417ca32287bb72
BLAKE2b-256 fc5b7f89694ff5f3cdc5c49e8ba3bbe084a7e3c31b1e9b4bea29df152069e80a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.2.3-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e6c9d4c70a50b252ab9a2bd6a7323992d305bb1771cb2ddf88683ac18d6f55de
MD5 4c84324b9fa11be224cb27ea4c5cf271
BLAKE2b-256 41f33ddc2ee76c183fd0ae78004df2440350ab47c1d77805018b5fdff7c11898

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for wry_py-0.2.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b575ccfdae430f0126ea1f74545efcef0069eddf54255d8815bfd748be553739
MD5 74220fca246938ca6b0c078317d0979a
BLAKE2b-256 edd476b5b906a890487905a9ace260ea35b6e6845e9be04144f4d3025eba30b7

See more details on using hashes here.

File details

Details for the file wry_py-0.2.3-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: wry_py-0.2.3-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 633.0 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.11.2

File hashes

Hashes for wry_py-0.2.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 4db8e3ef268ed3b9c58f8b05670ce416c68b7852cc8382485088396e3ffe642f
MD5 ec524b377b5c6855d47f98eacb06b080
BLAKE2b-256 7871a4113ec20e92320c7ecb4cd0d5f310c286a392231b2515bde40877921652

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