I have a program running many threads, one of them controls the interface and another launches some functions every few seconds. I want the timing thread to update a progres
You have to define a signal for the Crono object like this:
class Crono(QtCore.QThread):
tick = QtCore.pyqtSignal(int, name="changed") #New style signal
def __init__(self, parent):
QtCore.QThread.__init__(self,parent)
def checkStatus(self):
for x in range(1,101):
self.tick.emit(x)
time.sleep(1)
Then connect it to a slot of the progress bar.
class WTrainning(wMeta.WMeta, QtGui.QWidget):
def __init__(self):
super(WTrainning, self).__init__()
self.crono = Crono()
def createUI(self):
#Create GUI stuff here
#Connect signal of self.crono to a slot of self.progressBar
self.crono.tick.connect(self.progressBar.setValue)
What you were doing is connect the SIGNAL valueChanged
of the progressBar to its own SLOT setValue