
当前版本: 5.4(2025/01/27 发布)
pywebview is a lightweight BSD-licensed cross-platform wrapper around a webview component. pywebview allows to display HTML content in its own native GUI window. It gives you power of web technologies in your desktop application, hiding the fact that GUI is browser based. pywebview ships with a built-in HTTP server, DOM support in Python and window management functionality.,
Install
pip install pywebview
Depending on a platform you may need to install additional libraries. Refer to the installation page for details.
Hello world
import webview
webview.create_window('Hello world', 'https://pywebview.flowrl.com/')
webview.start()
Explore documentation or examples. If React is your thing, get started right away with React boilerplate.
跨平台
兼容 Windows、macOS、Linux 和 Android,确保在所有主要操作系统上提供一致的用户体验。
双向 Javascript↔Python 通信
无需 HTTP 或 REST,直接在 Javascript 和 Python 之间进行通信。
内置 HTTP 服务器
通过集成的 HTTP 服务器轻松提供静态文件,简化托管和访问 web 内容的过程。
窗口管理
控制窗口的外观和行为,包括其大小、位置和标题。轻松管理多个窗口。
原生组件
利用原生 GUI 元素,如菜单、消息框和文件对话框,提供无缝的用户界面。
DOM 支持
利用 Python API 操作和遍历 DOM 节点,而无需依赖 Javascript。
增强的文件系统支持
访问拖放文件的完整路径,按需创建保存文件和打开文件对话框。
友好的打包工具
轻松与流行的打包工具(如 pyinstaller、nuitka 和 py2app)集成,简化应用程序的打包和分发。