I am trying to learn PyQt
from rapid gui programming with python and qt
and currently learning Signals
and Slots
.
Below is a short snippet of my code:
self.connect(self.dial, SIGNAL("valueChanged(int)"),self.spinbox.setValue) #1
self.connect(self.dial, SIGNAL("valueChanged(int)"),self.getValue_dial) #2
self.connect(self.spinbox, SIGNAL("valueChanged(int)"),self.dial.setValue)
self.connect(self.spinbox, SIGNAL("valueChanged(int)"),self.getValue_spinbox)
def getValue_dial(self):
print self.dial.value()
def getValue_spinbox(self):
print self.dial.value()
What I am trying to achieve here is call 2
SLOTS at once that is spinbox.setValue
and getValue_dial
for dial
object as soon as ValueChanged(int)
signal is emitted.
The above code executes successfully without any errors and print
the appropriate values as they are changed.
Now my question is the above way appropriate to call multiple slots for a single signal.?
Can the above two statements(1 & 2) be combined into a single statement.
Here is the link for my complete code.