By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,907 Members | 1,963 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,907 IT Pros & Developers. It's quick & easy.

'int' object is not callable in an threaded app

P: n/a
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_())

May 22 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.