Dears,

I would like to create a list of QWidgets (lets say QDial). No problem till here.

self.motorDial = []
self.velocityEdit = []
for iMotor in xrange(3):
self.motorDial.append(QtGui.QDial())
self.velocityEdit.append(QtGui.QLineEdit())


The problem is to connect each of these Widgets to a function, passing to the function the index of the QDial which emitted the "valueChanged()" signal.
Something like:

for iMotor in xrange(3):
self.connect(self.motorDial[iMotor], QtCore.SIGNAL("valueChanged(int)"), self.setVelocity)

def setVelocity(self, val):
self.velocityEdit[iMotor].setText(str(self.motorDial[iMotor].value()))


How can the setVelocity function know the caller in order to set the correct self.velocityEdit[iMotor]?

For what I know during the connection no other arguments can be passed, but it is quite a pity since it would be nice to pass during each connection the identification index of the QDial.

Does anyone knows how to solve this problem?

Thank you in advance!

Can any one send me a code for loading clips program into wxpython......

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.