def qWait(msec): start = time.time() QtGui.QApplication.processEvents() while time.time() < start + msec * 0.001: QtGui.QApplication.processEvents()