PyQtWebEngine

5.15.7 · active · verified Wed Apr 15

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.

Warnings

Install

Imports

Quickstart

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.

import sys
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtCore import QUrl

class Browser(QMainWindow):
    def __init__(self):
        super().__init__()
        self.browser = QWebEngineView()
        self.browser.setUrl(QUrl('http://www.google.com'))
        self.setCentralWidget(self.browser)
        self.showMaximized()

if __name__ == '__main__':
    app = QApplication(sys.argv)
    QApplication.setApplicationName("PyQtWebEngine Browser")
    window = Browser()
    sys.exit(app.exec_())

view raw JSON →