我想通过for循环创建多个按钮。 按下按钮可调用相同的功能,但传递不同的参数。我该怎么做? 示例:
def someFunction(self):
for i in range(8):
square_btn_1 = QPushButton(self)
square_btn_1.clicked.connect(self.function(i))
def function(self, i):
print(i)
但是它总是发送7