Skip to main content

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:

  1. Frameless
  2. Shadow
  3. Resizeable
  4. Vertical Maximize
  5. Restrict client area to workspace when window maximized
  6. 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

webview2-0.0.4.tar.gz (144.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

webview2-0.0.4-py3-none-any.whl (143.3 kB view details)

Uploaded Python 3

File details

Details for the file webview2-0.0.4.tar.gz.

File metadata

  • Download URL: webview2-0.0.4.tar.gz
  • Upload date:
  • Size: 144.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for webview2-0.0.4.tar.gz
Algorithm Hash digest
SHA256 9db829d9b73f26ab0acb3f81ca134859e34afe8659ce43ad684cd48c01f7e59d
MD5 e00aa862a7495c0f3c67682db330cc1f
BLAKE2b-256 6b80e5b85e499f38804edd37e489b3c61b155ac8f1b3a4008448a2566684df92

See more details on using hashes here.

File details

Details for the file webview2-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: webview2-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 143.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for webview2-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b16df9a76e38755e20086bf2f9c94adaf3d63120fe938bbf0721845a4c680b72
MD5 bf18c5f3c9134a5c57c0434361ad34ae
BLAKE2b-256 efd9e1058030323938d39cfcf19f5bf7b2147d2a1280983a23c7dfb2ee09d0a0

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