When I try to use one QDialog object from threads I get this error. Here is the code I'm using:
import threading
import test_qdialog
from PyQt4 import QtGui, QtCore
class MyThread(threading.Thread):
    def __init__(self, id, window, mutex):
        self.id = id
        self.window = window
        self.mutex = mutex
        super(MyThread, self).__init__()
    def run(self):
        with self.mutex:
            result = self.window.exec_()
            if result == QtGui.QDialog.Accepted:
                print "Thread %d: %s" % (self.id, self.window.message_input.text())
if __name__ == "__main__":
    import sys
    app = QtGui.QApplication(sys.argv)
    mutex = threading.Lock()
    threads = []
    window = test_qdialog.MyDialog()
    for i in range(5):
        thread = MyThread(i, window, mutex)
        thread.start()
        threads.append(thread)
    for thread in threads:
        thread.join()
    sys.exit(app.exec_())
As written in this answer, if I get it right, I can't do it this way. But how can I do it then?
 
     
     
    