Q:

Qt Pyside displaying results in widgets

I am going through a lot of data in a loop, and updating status into a textedit widget on my mainwindow. The thing is, the textedit widget only gets update, after all my data in the loop is processed. I want to display it in the textedit widget as its processing.
for i in data:
  ...
  textedit.settext(i) <<---- this part is not updated "fast" enough to textedit widget
  ..

what can i do about this? Do i have to look in the direction of some form of multithreading? thanks
Update: Actually the whole scenario is i am doing some file operations, going through directories, connecting to databases, selecting stuff and then displaying to GUI. While my code runs in the background, i would also like to display results found to the QT textedit widget in "realtime". Right now, my widget shows the result after my file operations are done. And the GUI "hangs" while the file operations are being done.
thanks

A:

Its hard to write without seeing the rest of your code, but I'd recommend investigating slots and signals in Qt.
class myObject(QObject):
  somethingChanged= pyqtSignal(str)

  def __init__(self):
    super(myObject).__init__(self)
    # Here we indicate we will try and catch the signal.  
    self.somethingChanged.connect(self.updateText)

  def processData(self):
    for i in data:
      ...
      # Inside the loop you can fire off a signal.
      object.emit("somethingChanged")
      ...

  def updateText(self,text):
      textedit.setText(text) 

