Вот это( из assistant):
#include <QApplication>
#include <QTimer>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QTimer::singleShot(5000, &app, SLOT(quit()));
...
return app.exec();
}
#include <QApplication>
#include <QTimer>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QTimer::singleShot(5000, &app, SLOT(quit()));
...
return app.exec();
}
import sys
from PyQt4 import QtCore, QtGui
app = QtGui.QApplication(sys.argv)
label = QtGui.QLabel("GUI")
label.show()
timer = QtCore.QTimer.singleShot(5000, quit)
app.exec_()
import sys
from PyQt4 import QtCore,QtGui
app = QtGui.QApplication(sys.argv)
label = QtGui.QLabel("GUI")
print "wait 5 seconds"
QtCore.QTimer.singleShot(5000,app,QtCore.SLOT(quit()))
print "5 seconds passed"
label.show()
sys.exit(app.exec_())