Skip to main content

PyWebWinUI3

PyWebWinUI3 is a Windows desktop UI framework that combines:

  • a Python backend
  • a pywebview host window
  • a Svelte frontend rendered inside Edge WebView2
  • an XAML-like page format for declaring UI

The goal is to make desktop apps feel like WinUI3-style apps while still being driven from Python.

What It Does

PyWebWinUI3 lets you:

  • declare pages in XAML-like markup
  • bind controls to Python values
  • react to value changes and lifecycle events from Python
  • serve a bundled frontend from the Python runtime
  • keep a Windows-style shell with theme and accent synchronization

At runtime, Python owns the application state, pywebview hosts the window, and the Svelte app renders the page tree loaded from the bundled frontend.

Platform

PyWebWinUI3 is currently aimed at Windows.

Runtime dependencies:

  • pywebview
  • hPyT

Installation

pip install PyWebWinUI3

Quick Start

from pywebwinui3.core import MainWindow
from pywebwinui3.type import Status

app = MainWindow("PyWebWinUI3")

app.addSettings("Settings.xaml")
app.addPage("Dashboard.xaml")
app.addPage("Test.xaml")

app.values["test_input"] = "Hello, world"
app.values["test_switch"] = False

@app.onValueChange("test_noticeSample")
def show_notice(*_):
    app.notice(Status.Attention, "Title", "This is a sample notice")

app.start()

Minimal Page Example

<Page path="settings" icon="&#xE713;" name="Settings" title="Settings">
	<Box>
		<Horizontal>
			<Text>App theme</Text>
			<Space />
			<Select value="system_theme">
				<Option value="dark">Dark</Option>
				<Option value="light">Light</Option>
				<Option value="system">Use system setting</Option>
			</Select>
		</Horizontal>
	</Box>
</Page>

Core Concepts

MainWindow

pywebwinui3.core.MainWindow is the main entry point.

Important methods:

  • addPage(...)
  • addSettings(...)
  • start(debug=False, hidden=False, on_top=None, width=None, height=None, min_width=900, min_height=600)
  • notice(level, title, description, item=None)
  • pin(state)
  • syncValue(key, value)

values

app.values is the shared state dictionary between Python and the frontend.

Typical usage:

app.values["user_name"] = "Haruna"
app.values["is_enabled"] = True
app.values["progress"] = 50

The frontend reads these values directly, and user input writes back into the same store.

Built-in system values include keys such as:

  • system_title
  • system_icon
  • system_theme
  • system_accent
  • system_pages
  • system_settings
  • system_nofication
  • system_pin

Events

MainWindow exposes decorator-style event hooks:

  • @app.onValueChange(key)
  • @app.onAccentColorChange()
  • @app.onSetup()
  • @app.onExit()

Example:

@app.onValueChange("user_name")
def on_user_name_change(*_):
    print(app.values["user_name"])

Notifications

Use app.notice(...) to push InfoBar-style messages into the frontend.

from pywebwinui3.type import Status

app.notice(Status.Success, "Saved", "Settings were saved successfully")

Status values:

  • Status.Attention
  • Status.Success
  • Status.Caution
  • Status.Critical
  • Status.Neutral

Markup Model

Pages are loaded into a JSON tree and rendered by the frontend.

Common tags currently implemented:

  • Page
  • Box
  • Horizontal
  • Vertical
  • Text
  • Button
  • Input
  • Slider
  • Switch
  • Check
  • Radio
  • Select
  • Option
  • Image
  • Webview
  • Progressbar
  • Line
  • Space
  • Expender
  • If
  • Match
  • Repeat

Binding Model

PyWebWinUI3 supports two main binding styles:

  • direct value binding through attributes like value="test_input"
  • formatted text / expressions inside strings such as {user_name}

The frontend compiles and caches formatted expressions, while Python remains the source of truth for state.

Path-like targets such as nested array access are also handled by the runtime value system when used by supported controls.

Resource Resolution

Relative resource paths are resolved from the Python caller's directory first, then from the packaged frontend bundle directory.

This lets you write things like:

  • local XAML files via addPage("Dashboard.xaml")
  • local images in markup
  • bundled web assets shipped with the package

External URLs such as https://... and file://... are passed through as-is.

Window / Shell Behavior

The desktop shell is implemented with pywebview and provides:

  • a hidden-title-bar host window
  • theme and accent synchronization with Windows
  • always-on-top pinning
  • a pywebview API bridge between Python and the frontend
  • direct bundled frontend hosting from pywebwinui3/web/

Project Structure

PyWebWinUI3/
├─ pywebwinui3/
│  ├─ core.py        # public API, app state, pywebview host
│  ├─ util.py        # XAML loader, sync dict, accent watcher
│  ├─ event.py       # event system
│  ├─ type.py        # status and theme resource constants
│  └─ web/           # built frontend bundle shipped to users
├─ frontend/         # Svelte source
├─ example/          # sample application and XAML pages
└─ setup.py

Development Notes

If you are only using the package, you do not need to build the frontend manually.

If you are working on the framework itself:

  • Python runtime code lives in pywebwinui3/
  • Svelte source lives in frontend/
  • the distributable frontend bundle lives in pywebwinui3/web/

Example

See:

  • example/example.py
  • example/Settings.xaml
  • example/Dashboard.xaml
  • example/Test.xaml

License

Apache-2.0

Metadata

Release files for PyWebWinUI3 1.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PyWebWinUI3 1.2.3
File Size Uploaded Provenance Actions
pywebwinui3-1.2.3.tar.gz 3.2 MB With provenance Details for pywebwinui3-1.2.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for PyWebWinUI3 1.2.3
File Interpreter ABI Platform Actions
pywebwinui3-1.2.3-py3-none-any.whl Python 3 none any Details for pywebwinui3-1.2.3-py3-none-any.whl

Total release size: 6.5 MB

Release files / pywebwinui3-1.2.3.tar.gz

Download URL pywebwinui3-1.2.3.tar.gz
Size 3.2 MB
Tags Source
SHA-256 checksum
How to use checksums
8fed3636d2c44cba4b47e8e90766d1f69f0b0caadc8f38488e0c4c3c477f8322
BLAKE2b-256 checksum
How to use checksums
5c4cfef86ab5d56db187bd6deefdd450dc2651e9f15dc8602565e0cd9af66d7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 23, 2026.

Transparency log

Release files / pywebwinui3-1.2.3-py3-none-any.whl

Download URL pywebwinui3-1.2.3-py3-none-any.whl
Size 3.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
1b828713fd000729c9b4315a74f42cc47a92c9e4b498e81db8ebec3fb56659f5
BLAKE2b-256 checksum
How to use checksums
0ffc2808e929f72c4ea4c37109f19c9630ea72ec83dd28fe3273e66b39b53eb6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 23, 2026.

Transparency log

Security for PyWebWinUI3 1.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pywebwinui3-1.2.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.2.3 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page