There is a script and an interface to it written in pyqt4. During the execution of the script functions, the program interface freezes and (does not respond). No data until the end of the program is updated in the interface, for example, w.textbrowser.append. After performing all the functions data appears. The problem is that the interface name still has to follow the progress of the execution from the IDE.

I suspect that here it is necessary to use certain flows. Threads but I am not familiar with them. Is my guess correct and if so what do you advise to read in this case

    1 answer 1

    execute code in separate threads, transferring data to the interface via qt signals and slots

    from PyQt4 import QtGui, QtCore import threading, time class Wind(QtGui.QWidget): Signal = QtCore.pyqtSignal(list) def __init__(self): QtGui.QWidget.__init__(self) self.Signal.connect(lambda s: self.resize(s[0], s[1])) if __name__ == '__main__': import sys from PyQt4.QtGui import QApplication QApp = QApplication(sys.argv) w = Wind() w.show() # отдельный поток def resize(): for i in range(1000): w.Signal.emit([i, i]) # изменяем размер из другого потока time.sleep(0.1) threading.Thread(target=resize).start() QApp.exec()