Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def paintEngine(self):
# https://doc.qt.io/qt-5/qt.html#WidgetAttribute-enum WA_PaintOnScreen
return None
app = QtWidgets.QApplication([])
# %% Integrate QT with asyncio
if False:
# The qasync way, probably the best way, but needs a new event loop, so
# does not integrate so well (yet) with IDE's.
loop = qasync.QEventLoop(app)
asyncio.set_event_loop(loop)
# An experimental Pyzo thing I hacked together to switch loops
if hasattr(asyncio, "integrate_with_ide"):
asyncio.integrate_with_ide(loop, run=False)
else:
# The quick-n-dirty way, simple and effective, but this limits the
# rate in which qt can process events. If we could get an event
# when qt has pending events, this might actually be effective.
async def _keep_qt_alive():
while True:
await asyncio.sleep(0.01)
app.flush()
app.processEvents()
asyncio.get_event_loop().create_task(_keep_qt_alive())