PyQt6-WebEngine-Qt6

6.11.0 · active · verified Sun Apr 12

PyQt6-WebEngine-Qt6 is a supplementary package containing the essential subset of a Qt installation specifically required by PyQt6-WebEngine. It typically installs automatically as a dependency when a user installs PyQt6-WebEngine, which provides Python bindings for the Qt WebEngine framework. This framework enables embedding web content in applications using a Chromium-based engine. The current version is 6.11.0, and its release cadence generally aligns with updates to PyQt6 and the underlying Qt WebEngine.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to embed a basic web browser using `QWebEngineView` to display a URL. It initializes a `QApplication`, creates a `QWidget` to host the `QWebEngineView`, and sets a target URL. The `sys.exit(app.exec())` line starts the event loop, displaying the window.

import sys
from PyQt6.QtWidgets import QApplication, QWidget, QVBoxLayout
from PyQt6.QtWebEngineWidgets import QWebEngineView
from PyQt6.QtCore import QUrl


class SimpleBrowser(QWidget):
    def __init__(self):
        super().__init__()
        self.setWindowTitle('PyQt6 WebEngine Browser')
        self.setGeometry(100, 100, 1024, 768)

        layout = QVBoxLayout(self)
        self.webview = QWebEngineView()
        layout.addWidget(self.webview)

        # Load a URL (e.g., Google or your own site)
        self.webview.setUrl(QUrl('https://www.google.com'))

        self.setLayout(layout)


if __name__ == '__main__':
    app = QApplication(sys.argv)
    browser = SimpleBrowser()
    browser.show()
    sys.exit(app.exec())

view raw JSON →