Firstly I would recommend the PySide implementation of Qt.
In that situation (and plain pyQt) you should look into signals and slots:
http://qt-project.org/wiki/Signals_and_Slots_in_PySide
http://zetcode.com/gui/pyqt4/eventsandsignals/
Basically you just need to set up what is usually called a 'Worker' class that is just a QThread.
class Worker(QtCore.QThread):
updateProgress = QtCore.Signal(int) #or whatever you wanna call it
This ^^^ is where the code above goes.
Then what you want to do is connect the signal in the main GUI thread / class.
self.worker.updateProgress.connect(self.setProgress) #notice no ()
def setProgress(self, progress):
self.progressBar.setValue(progress)
Then finally inside the function that will output values you want:
self.updateProgress.emit(value)
This example implies something like a progress bar functionality. I know this post is old -- but this would have helped me so hopefully the googlers will find it useful ;)