I want to create multiple buttons by a for loop. Pressing on the buttons call same function but transfer a different parameters.
def someFunction(self):
buttons = [None] * 8
for i in range(8):
buttons[i] = QPushButton(self)
buttons[i].clicked.connect(self.function(i))
def function(self, i):
print(i)
I expect the output of buttons[i] to be i but the output always 7