PyQt6 WebEngine

6.11.0 · active · verified Sun Apr 12

PyQt6-WebEngine provides Python bindings for The Qt Company's Qt WebEngine framework, allowing developers to embed web content into their applications. It leverages Chromium, an open-source web browser project, to offer a fast and secure browsing experience. The library sits atop PyQt6, implementing the WebEngine functionality through three distinct modules. Releases typically occur roughly every six months, aligning with the upstream Qt WebEngine releases.

Warnings

Install

Imports

Quickstart

This basic example demonstrates how to embed a QWebEngineView widget within a PyQt6 application to display a web page. It initializes a QApplication, creates a window with a QVBoxLayout, adds a QWebEngineView, and loads Google.com.

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

app = QApplication(sys.argv)

window = QWidget()
window.setWindowTitle('Simple Web Browser')
window.setGeometry(100, 100, 800, 600)

layout = QVBoxLayout()
window.setLayout(layout)

view = QWebEngineView()
layout.addWidget(view)

# Load a URL
view.setUrl(QUrl('https://www.google.com/'))

window.show()
sys.exit(app.exec())

view raw JSON →