{"id":6810,"library":"pyqtwebengine","title":"PyQtWebEngine","description":"PyQtWebEngine is a set of Python bindings for The Qt Company's Qt WebEngine framework, providing the ability to embed web content in PyQt5 applications. It integrates the Chromium-based web engine, allowing developers to display and interact with web pages. The bindings are implemented as three separate modules sitting on top of PyQt5. The current version is 5.15.7 and it is actively maintained.","status":"active","version":"5.15.7","language":"en","source_language":"en","source_url":"https://www.riverbankcomputing.com/software/pyqtwebengine/","tags":["GUI","web browser","Qt","PyQt5","webview","desktop app"],"install":[{"cmd":"pip install PyQtWebEngine","lang":"bash","label":"Install PyQtWebEngine"}],"dependencies":[{"reason":"PyQtWebEngine provides bindings for the Qt WebEngine framework, which sits on top of and requires PyQt5 to function.","package":"PyQt5"}],"imports":[{"symbol":"QWebEngineView","correct":"from PyQt5.QtWebEngineWidgets import QWebEngineView"},{"symbol":"QWebEnginePage","correct":"from PyQt5.QtWebEngineWidgets import QWebEnginePage"},{"symbol":"QUrl","correct":"from PyQt5.QtCore import QUrl"}],"quickstart":{"code":"import sys\nfrom PyQt5.QtWidgets import QApplication, QMainWindow\nfrom PyQt5.QtWebEngineWidgets import QWebEngineView\nfrom PyQt5.QtCore import QUrl\n\nclass Browser(QMainWindow):\n    def __init__(self):\n        super().__init__()\n        self.browser = QWebEngineView()\n        self.browser.setUrl(QUrl('http://www.google.com'))\n        self.setCentralWidget(self.browser)\n        self.showMaximized()\n\nif __name__ == '__main__':\n    app = QApplication(sys.argv)\n    QApplication.setApplicationName(\"PyQtWebEngine Browser\")\n    window = Browser()\n    sys.exit(app.exec_())","lang":"python","description":"This quickstart code creates a simple PyQt5 application with an embedded QWebEngineView that loads Google's homepage. It demonstrates the basic setup required to display web content within a PyQt5 window."},"warnings":[{"fix":"For PyQt6, ensure 'pyqt6-webengine' is installed and update import statements to 'from PyQt6.QtWebEngineWidgets import ...'.","message":"When migrating from PyQt5 to PyQt6, the QtWebEngine module is no longer bundled with the main PyQt installation. For PyQt6, you must install 'pyqt6-webengine' separately (pip install pyqt6-webengine) and the import path changes from 'PyQt5.QtWebEngineWidgets' to 'PyQt6.QtWebEngineWidgets'.","severity":"breaking","affected_versions":"Transition from PyQt5 to PyQt6"},{"fix":"Always run 'pip install PyQtWebEngine' in addition to 'pip install PyQt5' to use the web engine features.","message":"Installing only 'PyQt5' will not include the 'QtWebEngineWidgets' module. 'PyQtWebEngine' is a separate package that must be installed explicitly.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Carefully review the license terms (GPL v3 or commercial) to ensure compliance with your application's distribution model. A commercial license may be required for proprietary software.","message":"PyQtWebEngine is dual-licensed under the GNU GPL v3 and a commercial license. Unlike some other Qt modules, it is *not* available under the LGPL. This has significant implications for proprietary applications.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Utilize `QWebEnginePage.runJavaScript()` to inject and execute JavaScript code for interacting with the web page's DOM and fetching results.","message":"Direct access to the Document Object Model (DOM) of a loaded web page is not provided by QWebEngineView. Interactions with the web content (e.g., executing JavaScript, getting values) are primarily achieved through `QWebEnginePage.runJavaScript()`.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}