Registry / web-framework / pywebview

pywebview

JSON →
library6.2.1pypypi✓ verified 24d ago

Build GUI for your Python program with JavaScript, HTML, and CSS. pywebview is a cross-platform library that creates a native web view window (using WebKit on macOS, GTK/Qt on Linux, Edge Chromium or MSHTML on Windows) to display HTML content and interact with Python. Current version 6.2.1, requires Python 3.7+ (3.8+ starting from 6.2). Releases are frequent, with several per year.

pip install pywebview
INSTALL
IMPORT
SIG · PYWEBVIEW
P
pywebview
web-frameworkpythonv6.2.1
Install
2.9s avg
Import
250ms
Disk
20MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v6.2.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.258s · 22.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.9s · import 0.242s · 23MB
20MB installed
● package 20MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

webview
import webview
from pywebview import webview
pywebview is the package name on PyPI, but the module is called 'webview'. Importing from pywebview raises ModuleNotFoundError.

Basic example: create a window, expose a Python API (js_api), and start the GUI loop.

import webview def greet(name): return f"Hello, {name}!" class Api: def greet(self, name): return greet(name) if __name__ == '__main__': window = webview.create_window("Hello world", "https://example.com", js_api=Api()) webview.start()
Debug
Known issues
breakingMinimum Python version bumped to 3.8 in version 6.2. Python 3.7 is no longer supported.
fix
Upgrade Python to 3.8 or higher. If you must use Python 3.7, pin pywebview to <6.2.
affects: >=6.2
gotchaImport as 'import webview', not 'from pywebview import webview'. The PyPI package name and the top-level module differ.
fix
Use 'import webview' in your code. pip install yields the same.
affects: All
deprecatedUsing window.events without the newer window.events API is deprecated. The old approach may stop working in future versions.
fix
Migrate to the new events pattern: window.events.before_show += handler (see docs).
affects: >=5.4
gotchaOn Linux, backend selection may be tricky. If both Qt and GTK are installed, pywebview uses Qt by default. Force GTK via webview.start(gui='gtk').
fix
To use GTK, set the environment variable WEBVIEW_GUI=gtk or pass gui='gtk' to webview.start().
affects: All
gotchaFullscreen mode may behave differently across platforms. On Windows, using fullscreen=True with a frame can cause issues. Prefer resizable=False for kiosk-like apps.
fix
Test fullscreen on each target platform. Consider using window.toggle_fullscreen() at runtime for better control.
affects: All
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pywebview'
Importing from pywebview instead of webview.
fix
Change import to 'import webview'.
ImportError: cannot import name 'create_window' from 'webview' (unknown location)
Trying to import create_window directly (e.g., 'from webview import create_window') without full module path. In some environments, this fails.
fix
Use 'window = webview.create_window(...)' after 'import webview'.
TypeError: create_window() missing 1 required positional argument: 'url'
The url parameter is required (even if empty string). Can't omit it.
fix
Provide url='' if you want a blank page: webview.create_window('Title', url='')
OSError: Cannot find any available GUI backend on this Linux system.
Linux system missing both Qt and GTK development libraries.
fix
Install PyQt5 (pip install PyQt5) or PyGObject + GTK3 dev packages (e.g., apt install python3-gi gir1.2-gtk-3.0).
Upgrade
Version history
6.2.1latest on PyPI · released Apr 15, 2026
Audit
Dependencies
PyQt5optionalRequired for Qt backend on Linux
PyGObjectoptionalRequired for GTK backend on Linux
Agent activity
117 hits · last 30 days
node
112
Amazon
1
OpenAI (training)
1
Resources
pywebview — pip install pywebview · libregistry