Merge two pieces of code | Qt Forum
forum.qt.io › topic › 128515Jul 14, 2021 · Must construct a QApplication first. Traceback (most recent call last): File "code_2.py", line 337, in <module> screen_pixmap = QScreen.grabWindow(app.desktop().winId()) AttributeError: 'NoneType' object has no attribute 'winId' Segmentation fault (core dumped) When I changed to this: screen_pixmap = QScreen.grabWindow(app.desktop())