'int' object is not callable in an threaded app

K

king kikapu

Hi,

i have a problem with the following piece of code that id just drive
me nuts (from the morning...)
I think is more Python specific than Qt, folks from Qt forum have
already give me directions of how to do it but that Python error
message is just impossible for me to figure out. And i am sure that it
something just under my nose...

So, i have a form with 2 spin boxes, a button and a progress bar. When
i hit the button i expect to see the progressbar filled with the
values of spFrom and spTo (the 2 spinboxes)

I was given help if how to setup correctly the Signals and Slots
mechanism but i am stuck at this Python error at the "worker.start()"
command:

TypeError: 'int' object is not callable


Before i go and suicide, has anybody an idea what is going on
here ??...



import sys
from PyQt4 import QtCore, QtGui
from calculatorform_ui import Ui_CalculatorForm
from ui_countNumbers import Ui_MainWindow
from time import sleep

class WorkerThread(QtCore.QThread):
def __init__(self, start, end):
QtCore.QThread.__init__(self)
self.start = start
self.end = end

def run(self):
for x in range(start, end):
self.emit(QtCore.SIGNAL("updateProgress"), x)


class CountNumbersForm(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QMainWindow.__init__(self, parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)

@QtCore.pyqtSignature("")
def on_start_clicked(self):
worker.start()

def updateProgress(self, val):
self.ui.progres.setValue(val)


if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
count = CountNumbersForm();
worker = WorkerThread(count.ui.spFrom.value(),
count.ui.spTo.value() + 1);
QtCore.QObject.connect(worker, QtCore.SIGNAL("updateProgress"),
count.updateProgress, QtCore.Qt.QueuedConnection)
count.show()
sys.exit(app.exec_())
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top