Python qt: qapplication
From wikinotes
QWidgets make extensive use of an eventloop to communicate between each other, and handle widget construction/deletion.
Any code making use of signals/slots requies that a QCoreApplication
is
running. Any visible GUI code requires that a QApplication
(a subclass)
is running.
GUI example
from Qt import QtWidgets
import sys
qapp = QtWidgets.QApplication(sys.argv)
# your UI code
sys.exit(qapp.exec_())
Console Example
from Qt import QtCore
import sys
qapp = QtCore.QCoreApplication(sys.argv)
# your console code
sys.exit(qapp.exec_())