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.2.tar.gz (42.4 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.2-cp314-cp314-win_amd64.whl (621.4 kB view details)

Uploaded CPython 3.14Windows x86-64

wry_py-0.2.2-cp314-cp314-win32.whl (569.3 kB view details)

Uploaded CPython 3.14Windows x86

wry_py-0.2.2-cp314-cp314-macosx_11_0_arm64.whl (875.0 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

wry_py-0.2.2-cp314-cp314-macosx_10_12_x86_64.whl (896.6 kB view details)

Uploaded CPython 3.14macOS 10.12+ x86-64

wry_py-0.2.2-cp313-cp313-win_amd64.whl (632.0 kB view details)

Uploaded CPython 3.13Windows x86-64

wry_py-0.2.2-cp313-cp313-macosx_11_0_arm64.whl (881.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

wry_py-0.2.2-cp313-cp313-macosx_10_12_x86_64.whl (908.6 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

wry_py-0.2.2-cp312-cp312-win_amd64.whl (632.5 kB view details)

Uploaded CPython 3.12Windows x86-64

wry_py-0.2.2-cp312-cp312-macosx_11_0_arm64.whl (881.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

wry_py-0.2.2-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.2-cp311-cp311-win_amd64.whl (631.1 kB view details)

Uploaded CPython 3.11Windows x86-64

wry_py-0.2.2-cp311-cp311-macosx_11_0_arm64.whl (881.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

wry_py-0.2.2-cp311-cp311-macosx_10_12_x86_64.whl (909.9 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

wry_py-0.2.2-cp310-cp310-win_amd64.whl (631.1 kB view details)

Uploaded CPython 3.10Windows x86-64

wry_py-0.2.2-cp39-cp39-win_amd64.whl (632.5 kB view details)

Uploaded CPython 3.9Windows x86-64

File details

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

File metadata

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

File hashes

Hashes for wry_py-0.2.2.tar.gz
Algorithm Hash digest
SHA256 f0db2e32093cc2dae81d277eff2d4d252af3ed5c31a19bd61ea265875770c028
MD5 157e3a8e46930869dfbdc874103bf6fe
BLAKE2b-256 b1ca6a71605019e465614b3fc810a4945d1f7745004b11ea66e79f6cef343967

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wry_py-0.2.2-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 621.4 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.2-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 be72d82a3fb8ef4c6b87f411116a4324488a477bbd4aaed2a1a7306e131f2d77
MD5 c30a200f23f6f873fff41809fbd6c464
BLAKE2b-256 dd6d583a59405e92d34001de04e33366d4533ae50b811880ce2e1eeb568681f9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wry_py-0.2.2-cp314-cp314-win32.whl
  • Upload date:
  • Size: 569.3 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.2-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 cb52e425bd2e74ebdf14c38652367b5c605d98e79af8409fb6d342783b9c9369
MD5 24b49e7d30d7510e0b72c5c48da9fa73
BLAKE2b-256 ff44c67339485db191ca4c2b6cb42cf421f7da511d24af1f05f66e1968c3d463

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.2.2-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e509b176f0e4b46f23b40ef01aa36d535afc62e7454bec5a30908b2efcdf9f44
MD5 0db16c7db03c546e9d3e09b5d72f5371
BLAKE2b-256 09b4321e92ed3492827037d3f1cbc651b1dd8548db08d099f29bcc2831a548be

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.2.2-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 006da45e9deb43f4e1acc4e1a42599ecf7070f0e8a74a629e3303c640a43f4d1
MD5 6c3296981e3df6ee712fbe8f498f1f5a
BLAKE2b-256 ec0d0796eef1ba5d4b665a4b3e52632f27342c2ad26f51193868c923faf76b95

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wry_py-0.2.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 632.0 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.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e1dc80d3b3c413b74b8d34024677bcf19866f8e2d4fcdc91fb61c9a0ac0b1268
MD5 7ff9ed4bbcd2234030a7b1496be266ce
BLAKE2b-256 bf370950c344375d01182363d9afc2f57a39526b7ab80040ae87f74d248689b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.2.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7af079e3320674ce986d74274f33ef366319357f7d177ef28cc0ab7526580db6
MD5 3d5e5333845f621993a64e3462995b00
BLAKE2b-256 4cea9fca6e12387f1ee6a5d1a4bc8276ddb267e119eea52e39e590e1808bba4e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.2.2-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 5d462edc707c51a028e8d906a230cf769c41dc59cfcf61245dfa966f3f49d17f
MD5 fd4250dd9a833a3e8290d8718f363cd1
BLAKE2b-256 caa2260e7ad9f9c08fcd721774f9f26ede3cb56acae0affa274bcee457e0e350

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wry_py-0.2.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 632.5 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.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 54f1db85c411cf620104ed1bae393e518793aef51d1ea55e6dfb2096d5bb38c6
MD5 131a57634025ea527200ef2b6ca8ae38
BLAKE2b-256 ff29b3f702b0b0e6072e619e45abbabd6a3dd6026bd331b02c339d0b65d93227

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.2.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f5b3ecd36b7ac327cbdf341869707ffcfb8daebface56affca9511538411aeb3
MD5 05121db8e2de89080baf5e73dc56e468
BLAKE2b-256 fe87e3edbd770aa401d376e1c9caaed644a49f899222d1c298fd131adca42620

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.2.2-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 80998f8c8af5c58b4319ad3ca7daaeba9c99046f0014f2eb4cc2de5b5f62fb34
MD5 73ae47ae9958aeea7bfd090664d6d517
BLAKE2b-256 870ca3e1e99441c49d4ad5c8349d65edfc2025cb8dbd1e09593140c89d4c9c1c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wry_py-0.2.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 631.1 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.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c0c8c964af925a0016bfa80b1d7952f368a5f33c9861193d7fa20220725ea42a
MD5 10110b83ec62fe47c51fcff66a8700cd
BLAKE2b-256 89483a431f2177565e87497a62df98cf546ea8108162872bc04a8246dfb1f124

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.2.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4f313ec6098887500bd0f77c0c6e0f20b7d7902f2d349ef1dfbc6520fce1b3eb
MD5 b2e970631af534476e2934ec9301e00d
BLAKE2b-256 cfb5c79f13096f0b18950c7f3ce5f83e42e6b139b52bc40538209c1d8acfa7ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.2.2-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2822eb7ea36a5811074866eb918967677d04c3dbd9a905d20439fdb35a48ebd2
MD5 41999fa665f97ab379e249a60f6352cc
BLAKE2b-256 73fe14574e00f20f682f0137c9d67d09f7095caedb0205e03f70f1ce8a91e01b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wry_py-0.2.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 631.1 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.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c15f404865867c46eb60d8e32f574a494960fc0779abba31abb1f7acc75c74ab
MD5 dc27678ededb0608cd134ecfdd461e75
BLAKE2b-256 c3a1179e0c72879d9db01335f33179e29f787dbaa430d531c5e038050ab157d5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wry_py-0.2.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 632.5 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.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 ba107780c27bfc3a13ce0abf5b35aac2319bd7437fdd8ce0af511badcbb5ad62
MD5 75208b9928146037698d52960fe39282
BLAKE2b-256 06fc547cd080f448d314e551a4c9e47803948db3c874aa51cbf0aa58abfd472b

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