Skip to content

QApplication


The QApplication class manages the GUI application's control flow and main settings. It is the starting point for the GUI application. Every GUI application must have exactly one instance of this class.


Methods


Examples


app = QtWidgets.QApplication()
window = QtWidgets.QMainWindow()
window.show()
app.exec()
In the above example, an instance of the QApplication class is created and a QMainWindow is created and shown. The exec method is then called to start the application event loop. Running the above code will display an empty window.



exec()

Enters the main event loop and waits the application to finish. The event loop is quit when the last window is closed.

Returns:

Type Description
int

The return code of the application.