Build immersive applications supported by WebView2 on Windows Operation Systems
Project description
webview2
Build immersive applications supported by WebView2 on Windows Operation Systems
GUI Framework
Instead of WinForms and WPF, Use native Win32 directly.
The reason for choosing Win32 is that only the native API provides full control over window functionality, including achieving an immersive visual effect.
This project uses Win32 in a unique way: the core functionality is built with pywin32 to fully leverage Python’s capabilities.
For the WebView2 component, which exposes COM interfaces, we adopted a C++-wrapped DLL approach, supported by WebView2Window.
Because WebView2’s default rendering mode blocks interaction with the operating system, WebView2Window employs the Composition rendering mode.
In Composition mode, the WebView window achieves the same level of immersive styling as seen in applications like Visual Studio and JetBrains IDEs.
WebView2Window provides the following features:
- Frameless
- Shadow
- Resizeable
- Vertical Maximize
- Restrict client area to workspace when window maximized
- Minimize, maximize, restore and close buttons consistent with the behavior of system windows
Usage
import asyncio
from webview2 import Window, webview2_api
class MainWindow(Window):
@webview2_api
def greeting(self):
"""
JavaScript side invoke `await window.webview2.api.greeting()`
"""
return "hello webview2"
win = MainWindow(
title="My App", size="1480x960",# icon="logo.ico",
url="https://www.bing.com",# cache="PATH_OF_WEBVIEW2_CACHE"
)
asyncio.run(win.run())
Titlebar
Mark the css app-region:drag; of the title bar element to achieve the effect of dragging the title bar.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file webview2-0.0.3.tar.gz.
File metadata
- Download URL: webview2-0.0.3.tar.gz
- Upload date:
- Size: 144.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63e46ab1778509a6eaa1a30b9b2677cbac4e6c30a2f4b0af8d87a54824efde6b
|
|
| MD5 |
63db50e39a00fdd8e5f2863772b546b0
|
|
| BLAKE2b-256 |
88aa002659ee85a0c3a3ba58b26d91659702c1c39d2e5210bfc9dbfebfc2c5d8
|
File details
Details for the file webview2-0.0.3-py3-none-any.whl.
File metadata
- Download URL: webview2-0.0.3-py3-none-any.whl
- Upload date:
- Size: 143.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fea9b18744e52d757627cc7dec5e2ab9af202877963340cd2ba7d2d813f4e220
|
|
| MD5 |
208fd1db89f45072bffbe8cc8614fca7
|
|
| BLAKE2b-256 |
42552f4b28083c89aa307c3472113ab42881b61cd794cd3d8b63747b41fab32a
|