[Python] Must construct a QApplication while it is already constructed?

Discussão em 'Python' iniciado por Stack, Junho 30, 2025.

  1. Stack

    Stack Membro Participativo

    Here is the code.

    import sys

    from PyQt6.QtWidgets import QApplication
    from qpageview import View

    app = QApplication(sys.argv)
    view = View()
    view.show()
    sys.exit(app.exec())


    When I run it from console, I get "QWidget: Must construct a QApplication before a QWidget" error. But if I change PyQt6 to PyQt5, it works and shows the widget (qpageview is also installed and works properly). Isn't a row with QApplication enough to construct QApplication in PyQt6?

    Continue reading...

Compartilhe esta Página