import time import sys, threading from PyQt4 import QtGui, QtCore from PyQt4.QtGui import QApplication class Global: def __init__(self): for c in MyClass, MainWindow: cl = c() setattr(self, c.__name__, cl) setattr(cl, 'global_', self) class MyClass: def work(self): for r in range(100): if r == 2: self.global_.MainWindow.SignalBox.emit('MyClass NO PAUSE') # need pause !!! else: print(r) time.sleep(1) class MainWindow(QtGui.QWidget): Signal = QtCore.pyqtSignal(str) SignalBox = QtCore.pyqtSignal(str) def __init__(self): QtGui.QWidget.__init__(self) self.resize(300, 300) self.lab = QtGui.QLabel() lay = QtGui.QGridLayout() lay.addWidget(self.lab) self.setLayout(lay) self.msgBox = lambda txt: getattr(QtGui.QMessageBox(), 'information')(self, txt, txt) self.Signal.connect(self.lab.setText) self.SignalBox.connect(self.msgBox) def thread_no_wait(self): self.global_.MainWindow.SignalBox.emit('MyClass PAUSE OK') threading.Thread(target=self.global_.MyClass.work).start() def thread_main(self): def my_work(): for r in range(100): self.Signal.emit(str(r)) time.sleep(1) threading.Thread(target=my_work).start() if __name__ == '__main__': app = QApplication(sys.argv) g = Global() g.MainWindow.show() g.MainWindow.thread_main() g.MainWindow.thread_no_wait() app.exec_() MyClass.work runs in a separate thread without a join It is necessary that MyClass suspended if it calls a QMessageBox If you define a QMessageBox outside the MainWindow , an error will be caused
QObject::startTimer: timers cannot be started from another thread QApplication: Object event filter cannot be in a different thread. And with such a call, QMessageBox is called in a separate thread and the work is not suspended.