![]() |
2010-06-12
, 06:23
|
Posts: 341 |
Thanked: 57 times |
Joined on Nov 2009
|
#2
|
![]() |
2010-06-12
, 08:18
|
|
Posts: 1,366 |
Thanked: 1,185 times |
Joined on Jan 2006
|
#3
|
![]() |
2010-06-12
, 08:26
|
Posts: 70 |
Thanked: 39 times |
Joined on Mar 2010
|
#4
|
def __init__(self): ... self.connect(button1, SIGNAL("pressed()"), lambda: self.pressedNum(1)) ...
def pressedNum(self, num): self.computeFactorial(num)
![]() |
2010-06-12
, 15:23
|
Posts: 415 |
Thanked: 732 times |
Joined on Jan 2009
@ Finland
|
#5
|
For example, say you have like 10 buttons, all of which pass a number into a factorial function .. the only difference is that they all pass a different number into this one factorial function ... suppose the function is:
int factorial (int a);
so for example, button1 evaluates this function where a =1,
so for example, button2 evaluates this function where a =2,
so for example, button3 evaluates this function where a =3,
and so on ..
In such a case, is there any way to connect these multiple 'clicked' signals from each individual button to the same factorial slot, but just pass in a different value for a .. ? The alternative is to make a connect statement for each individual button, which seems rather inefficient considering they all do more or less the same thing ..