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.1.tar.gz (43.0 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.1-cp314-cp314-win_amd64.whl (620.8 kB view details)

Uploaded CPython 3.14Windows x86-64

wry_py-0.2.1-cp314-cp314-win32.whl (568.7 kB view details)

Uploaded CPython 3.14Windows x86

wry_py-0.2.1-cp314-cp314-macosx_11_0_arm64.whl (874.1 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

wry_py-0.2.1-cp314-cp314-macosx_10_12_x86_64.whl (895.8 kB view details)

Uploaded CPython 3.14macOS 10.12+ x86-64

wry_py-0.2.1-cp313-cp313-win_amd64.whl (631.5 kB view details)

Uploaded CPython 3.13Windows x86-64

wry_py-0.2.1-cp313-cp313-macosx_11_0_arm64.whl (881.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

wry_py-0.2.1-cp313-cp313-macosx_10_12_x86_64.whl (907.8 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

wry_py-0.2.1-cp312-cp312-win_amd64.whl (632.0 kB view details)

Uploaded CPython 3.12Windows x86-64

wry_py-0.2.1-cp312-cp312-macosx_11_0_arm64.whl (881.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

wry_py-0.2.1-cp312-cp312-macosx_10_12_x86_64.whl (908.3 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

wry_py-0.2.1-cp311-cp311-win_amd64.whl (630.9 kB view details)

Uploaded CPython 3.11Windows x86-64

wry_py-0.2.1-cp311-cp311-macosx_11_0_arm64.whl (881.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

wry_py-0.2.1-cp311-cp311-macosx_10_12_x86_64.whl (909.5 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

wry_py-0.2.1-cp310-cp310-win_amd64.whl (630.9 kB view details)

Uploaded CPython 3.10Windows x86-64

wry_py-0.2.1-cp39-cp39-win_amd64.whl (632.2 kB view details)

Uploaded CPython 3.9Windows x86-64

File details

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

File metadata

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

File hashes

Hashes for wry_py-0.2.1.tar.gz
Algorithm Hash digest
SHA256 258538b6efb4470dbcd989f95da9a10043287becca08fe83c377253477838f95
MD5 982d4792145903523d8a8c518b049b9e
BLAKE2b-256 c0c0004d6e5e6dc719759dbdcd3986b2a9c13f571945c68bac4f9922c3192021

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wry_py-0.2.1-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 620.8 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.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 0c4fb1cce53902b09f6b50f71cee44e115e4cc567c8e65e84ffcac09b9b3b2ea
MD5 088e7818de91d84efbb58abe3c3acb8f
BLAKE2b-256 bb7c3fd8556d8377dcf7d1c023cad83b08dee316d5aad6daa41a42263ddad8b9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wry_py-0.2.1-cp314-cp314-win32.whl
  • Upload date:
  • Size: 568.7 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.1-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 39ab4c3c3ec0cd6025d7b209549f96a10d79ad097901d91dbe1b6f695e7f7e36
MD5 8b2dd79907d31651cff1abfa8d4c5dbb
BLAKE2b-256 0aef8c89f7c13f11f8c2dfb08a264f28aa22044b3b03bb56da1968fdeec60ec1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.2.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ab632a1179e1b6634f221b2b16fe0f3c42af1711b9de23e09036b7ede056091c
MD5 5c316e38623968f6e48f4503d61cb02e
BLAKE2b-256 94c65d7afec4d295d17396e21ce21635147a474ebacbbca129298c3c74c6af5a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.2.1-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a3e8ee02c7162487dd75a6ef110bc4d013a410e3486ac90621f52641a83d774b
MD5 22aa8b9ed7acd895871b99a18ba56625
BLAKE2b-256 fc493efe83eff631177716e148ad0fd32184229f539237910fa4cd385c336305

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wry_py-0.2.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 631.5 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.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 5b00f5c422d4842b9ee9fd162f559ec89307eb828d2bc14a3fbbcd6024188bc2
MD5 9450897762a57ae11946bae71d1eb03d
BLAKE2b-256 f7a87e08b41534c1ab35b82ada288144355df10d34197931f9749ae198333c68

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.2.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 197c7eddc05f7faabae29a44494531a4ed0ff8f8141608f1c3e2722586dd9424
MD5 0f8b0ab17043e464cb23dc8f1c0fb050
BLAKE2b-256 204132221c6470fc18ffc207785111e09e346c6bf3e8e155a79adbb343041026

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.2.1-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ba7d6e05f4510898d2dc5600571da0e8cf61660f03087a573266ba270449358b
MD5 13a9edac34310c3607755bd6a5c968d2
BLAKE2b-256 6e2ad50b9a04b3f118bf9bf3a2c7cb3d34db4b5f5af899f5e7fc80dc0955ef95

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wry_py-0.2.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 632.0 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.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f2dc90189c539f28e8717bdbf4740fa5253bab989d6fdf8c227091c3180bf8e2
MD5 6c2c47099611023f70b7230ca793a90d
BLAKE2b-256 dddf804242d55a3c0dae51764f7baad381ad83dfe93ee24c019b8a6af2d10c53

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.2.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b734d292a0c37899dd3908618f7450d3bbdcd7fd7193de592431a30142622abb
MD5 34772affed9a23af41e129be0377d866
BLAKE2b-256 6aa66e04f6c0f14447be3103e2f6a3b7b89ffc34c7fd0a56ec90fc5b56e35bd5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.2.1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 24e1f8e7392494b437355cc89230d114b6852351d42593c826e62a8cfbf15b1e
MD5 112bdbdd2126bae6adec133f53835072
BLAKE2b-256 c231cdbde5b599ded549c93069a6181794d0b33749985b00ed9315e9f3770bd4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wry_py-0.2.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 630.9 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.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5f96786eb6fe9adc50845a0809dc726cfb57b6104507bfa6fc11cb03d8faaa36
MD5 388b7d90e160db5c81337b1a9ffd607e
BLAKE2b-256 4cb60437ff533dcf8b817479ec763003a49c22b5e41da52c9c88909fe0a8998f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.2.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c7dca00b53b49fa225cd9e972bb2bad0400e3f1c55f789576587589154403f81
MD5 60fb08ab6aec085c3fa4f2d24fda574e
BLAKE2b-256 2ea376a4e3b39855b0e89f3ee8beba0840c318caaca1baea3a6d1752f74c11e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.2.1-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 92eaa9b86d8e7f51d2d3c21c32db6aba8056a1b90a37dbc7e5312401e64d634c
MD5 7cf7705df8e3bb8fbd152aa795ce5a94
BLAKE2b-256 447f88f508abe22a9cd0364e3d72acf2d1101b10e5040cb20476e2063f508935

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wry_py-0.2.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 630.9 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.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 33669cab7be7ac2b4e37af0a585f3ebac85f8f99dbcbe8b73bab446a765868c3
MD5 b61707a2881a6b669fad127ba74b922f
BLAKE2b-256 698bf0f14298aa7698f3ade29bfda15cd31bd94799b6f50aeffd612405ddb5c9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wry_py-0.2.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 632.2 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.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 2ee2daeb985ed94525766b770d301807e4b8dcdf4cb89ab29dd495813c7f517d
MD5 9fe9268607cf3e92837aef8acebc085a
BLAKE2b-256 5aad34f6b5f07542679fac8915cb009905bdce8093bba92c53de2d1e0f29a53b

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