__init__.py 334 B

1234567891011121314151617
  1. import asyncio
  2. import sys
  3. import qasync
  4. from PyQt5 import QtWidgets
  5. qtapp = None
  6. loop = None
  7. def init_qtapp():
  8. global qtapp, loop
  9. if qtapp is None:
  10. qtapp = QtWidgets.QApplication(sys.argv)
  11. loop = qasync.QEventLoop(qtapp)
  12. asyncio.set_event_loop(loop)
  13. qtapp.processEvents()
  14. return qtapp, loop