No window appearing when using PyQt6 with QAsync, seems to terminate in super().__init__()

47 Views Asked by At

I am trying to use Qt-designer to make a layout that I then use in an application with QAsync. The code runs, but when it gets to super().__init__() it seems to return without ever running self.setupUi(self)

I am following code from: https://github.com/CabbageDevelopment/qasync/blob/master/examples/aiohttp_fetch.py https://youtu.be/1-mMCkJAbWQ

import asyncio
from qasync import asyncSlot, QEventLoop

from PyQt6 import QtWidgets

from WindowLayout import *

class GCSWindow(QtWidgets.QMainWindow, Ui_MainWindow):
    def __init__(self):
        super().__init__()
        self.setupUi(self)
        self.show()

async def main():
    app = QtWidgets.QApplication(sys.argv)
    loop = QEventLoop(app)
    asyncio.set_event_loop(loop)
    gcsWindow = GCSWindow()
    gcsWindow.show()

    with loop:
        sys.exit(loop.run_forever())

if __name__ == "__main__":
    asyncio.run(main())

The only way that I am able to open a window is if I open the window from main

0

There are 0 best solutions below