It is very strange that you crash in QT. So in most cases, either Exception occurs, from which it is easy to understand what the problem is. Or QT falls in Segmentation fault.
Then, as KoVadim wrote to you, the returned code is the developer's business. He could decide in some situations to return a non-zero code.
Also, a nonzero code may be returned due to the development environment, for example, PyCharm had an error and when the debug code returned 135. And then you need to look at the documentation and / or IDE bugtracker.
The returned code from QT is determined by two methods, if quit is called in the application (by default), it will be 0, or exit (return code) is called, then the return code is the one that is passed to the function.
Here is a simple example, just close - everything is fine, press a button and there will be a return code of 5. Code 5 is just because I decided so.
from PyQt5 import Qt class Window(Qt.QWidget): def __init__(self): super().__init__() layout = Qt.QVBoxLayout(self) self.btn = Qt.QPushButton() layout.addWidget(self.btn) self.btn.clicked.connect(self.on_button) def on_button(self): Qt.QApplication.instance().exit(5) if __name__ == '__main__': app = Qt.QApplication([]) w = Window() w.show() result = app.exec() print(result) if result == 0: print("It's OK!") else: print("Something wrong! Button was pressed!")
$?which stores it. read on - KoVadim