Skip to main content

Python bindings for Wry/Tao

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

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.1.7.tar.gz (35.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.1.7-cp314-cp314-win_amd64.whl (584.8 kB view details)

Uploaded CPython 3.14Windows x86-64

wry_py-0.1.7-cp314-cp314-win32.whl (542.3 kB view details)

Uploaded CPython 3.14Windows x86

wry_py-0.1.7-cp314-cp314-macosx_11_0_arm64.whl (836.8 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

wry_py-0.1.7-cp314-cp314-macosx_10_12_x86_64.whl (857.8 kB view details)

Uploaded CPython 3.14macOS 10.12+ x86-64

wry_py-0.1.7-cp313-cp313-win_amd64.whl (594.6 kB view details)

Uploaded CPython 3.13Windows x86-64

wry_py-0.1.7-cp313-cp313-macosx_11_0_arm64.whl (841.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

wry_py-0.1.7-cp313-cp313-macosx_10_12_x86_64.whl (867.2 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

wry_py-0.1.7-cp312-cp312-win_amd64.whl (594.7 kB view details)

Uploaded CPython 3.12Windows x86-64

wry_py-0.1.7-cp312-cp312-macosx_11_0_arm64.whl (841.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

wry_py-0.1.7-cp312-cp312-macosx_10_12_x86_64.whl (867.0 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

wry_py-0.1.7-cp311-cp311-win_amd64.whl (595.7 kB view details)

Uploaded CPython 3.11Windows x86-64

wry_py-0.1.7-cp311-cp311-macosx_11_0_arm64.whl (844.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

wry_py-0.1.7-cp311-cp311-macosx_10_12_x86_64.whl (867.2 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

wry_py-0.1.7-cp310-cp310-win_amd64.whl (595.7 kB view details)

Uploaded CPython 3.10Windows x86-64

File details

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

File metadata

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

File hashes

Hashes for wry_py-0.1.7.tar.gz
Algorithm Hash digest
SHA256 29f76a41a181c45663e9710c708edbfd5a14b7bdb3397c19ce88bd145e8465ae
MD5 c1318de6a8c569b288f232ac86ce9156
BLAKE2b-256 1497203bf3c9f59155e1f063c3f98b3f327d4f2ab830f7034882a5bbcf1ca918

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wry_py-0.1.7-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 584.8 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.1.7-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 d8d23177bf5455c526a66b1e936806b9c825aa984afe79baaff7bc68e958a614
MD5 736e6d610eb1d690ae039744834c5b0b
BLAKE2b-256 95d5e30d0ab2d5f356f3782c48ad3f9d88b8075004d4ccb9c45b993fe12e5d8b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wry_py-0.1.7-cp314-cp314-win32.whl
  • Upload date:
  • Size: 542.3 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.1.7-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 8ee63ed87b60f1a7e8fbbbc8e5ff1743768727a7e237a6fb3d8d50841c8b7e25
MD5 8f7f4159564578f2c77a0a0c7b9f580a
BLAKE2b-256 11233ff43db55f978bba23ac57e75353919c965548c65e9f075aa3d84a77ea55

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.1.7-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f0103d2bdb59f6333bd932b50346970094d18b4b18d2513d2b3ac15047e88934
MD5 c533d2742bbd847bb5d7b547222fb8c5
BLAKE2b-256 98e0334581767da6f7ee0f27c645a43bd7dff7adad347ae10be720a0e0f4dfd1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.1.7-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d984fb9667a48999f63666c6c59103a9ed5b9e558f8299a7238d8e5a13002dee
MD5 0af22da92ed637efb859bfac97b9eb23
BLAKE2b-256 d6c3d530bd7ba4de3fcb7596c02c914f39bdd2dccb6fc2a3e2f6ff13eb7a9e38

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wry_py-0.1.7-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 594.6 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.1.7-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f1944c19179f4e6f8e813324842af1d94fc6133ae619a64b192b054dc6a550fd
MD5 7676b1247e18636e05ab110fed6da547
BLAKE2b-256 9f104232bdcb667af00cfe515c85496bfecd6625d2393c8185fedfa0f07b19f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.1.7-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d40a330facd09c2df60707eb06bc2f78d8f7a0ef697b0966564aedce858f965c
MD5 09df03a39af6b0710ce82cb643b91cc1
BLAKE2b-256 4c8ac0a277859fb668e223f1518bd035452824774cbb346f85d5b0790d26fec4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.1.7-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 28874abd2d113318ed703eaa3b11b3628ef9658ec62b14b33d1d3793db94a3cd
MD5 5f17814f648f0e4b6630d1cb0e4cfe59
BLAKE2b-256 e9e01786f75fb0ccaae0aa3e3540aa9d10a2f7abb7f8addd70e5f873c31a521b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wry_py-0.1.7-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 594.7 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.1.7-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 bc9798b2403cd4fcb389be9c00306acd81b6c1ce57706ad66dacbfec61827606
MD5 a9b1627a11b2258588fcadb687d2636d
BLAKE2b-256 156cb9049120ec22b62e1a6ec61d25c85bf9c5432d4ec4f7638a1afb441629b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.1.7-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 297c5e2a120f457259e529ab8dc0c662aae738dc28a6a6aa1e5d7042e41e9b25
MD5 62e026e286e0e848174bf4d2b816c43c
BLAKE2b-256 efa0c4e70ac96c001d5728aa3bd49e9a97a03ebd9886b8d0519724c3298c019a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.1.7-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6602a21df2c0f5b6a46da97055f52be289ff132f0d26e7d565fa52e069aa1e93
MD5 e48239e49e9defc36e0ddeb296370090
BLAKE2b-256 006a9e848b70a1cd8ae130bb35aee0bc58584bd743e81c77be8907e0e89252ca

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wry_py-0.1.7-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 595.7 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.1.7-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 53d3fc5478119b9bcb1b98a08c287443bf38ce08c90283401705a0d50461a428
MD5 94abef6687f49d26e8db7574a4429cd6
BLAKE2b-256 126fd1bc6eba0c89a4ab189c7098921c891fc251ae5cba2f6e699873db3e3ee1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.1.7-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f98d698dfe5c5500446db0225918726d2d2319cb9d9c46c9c2158a3cafa71ee8
MD5 d36322e6426413ddb8005ae2629a6b43
BLAKE2b-256 ab8cd0c20450b84a643982c5ed9767e06160c6c1237cacd3ac8739ad5bbc0a83

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wry_py-0.1.7-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2f598f3d8943a88aab2c58c321b9e8ec44c27d2ed6394b4725f2e4b1a82f0ea6
MD5 73bb12bf85b2073d57b44e0d48196f96
BLAKE2b-256 1627ca0e81ce03231140691a558c7becf0c142457da39bb79b46a85a1f71f2e8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wry_py-0.1.7-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 595.7 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.1.7-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d2e2afb6f2b47033d8b484f67b466c14bebb9514ce11f24d8191ea330de2c2b0
MD5 2446bb74c82e26361cc8a7a123d4074f
BLAKE2b-256 1c27efede97f1d5a9e5eab7e77879b5a3452875f9c13277757ead7b9fc6cc93c

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