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 pywebviewVerified import paths — ran on the pinned version, not inferred.
Basic example: create a window, expose a Python API (js_api), and start the GUI loop.
Upgrade Python to 3.8 or higher. If you must use Python 3.7, pin pywebview to <6.2.
Use 'import webview' in your code. pip install yields the same.
Migrate to the new events pattern: window.events.before_show += handler (see docs).
To use GTK, set the environment variable WEBVIEW_GUI=gtk or pass gui='gtk' to webview.start().
Test fullscreen on each target platform. Consider using window.toggle_fullscreen() at runtime for better control.
Change import to 'import webview'.
Use 'window = webview.create_window(...)' after 'import webview'.
Provide url='' if you want a blank page: webview.create_window('Title', url='')Install PyQt5 (pip install PyQt5) or PyGObject + GTK3 dev packages (e.g., apt install python3-gi gir1.2-gtk-3.0).