[Python] I cannot display a .html page on an app from PyQt6

Discussão em 'Python' iniciado por Stack, Março 5, 2025.

  1. Stack

    Stack Membro Participativo

    Operating System is Windows 10. Whenever I try to display any form of .html file, whether it is local or on the internet, I either get a UI from PyQt6 that is blank, or error:

    I have successfully installed required dependencies, pip install PyQt6 PyQt6-WebEngine.

    Full output is

    [Running] python -u "c:\Users\PC\OneDrive\Desktop\main.py"

    [Done] exited with code=3221226505 in 0.46 seconds


    This is my code

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

    app = QApplication([])
    window = QWidget()
    layout = QVBoxLayout()

    view = QWebEngineView()
    layout.addWidget(view)

    view.setUrl(QUrl("https://www.google.com/"))

    window.setLayout(layout)
    window.show()

    app.exec()

    Continue reading...

Compartilhe esta Página