How Can I Create PushButtons With connect using loop
list = ['apple','orange','banana','carrot']
for i,s in enumerate(list)
list[i] = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
list[i].setText(s[0])
list[i].clicked.connect(lambda:getbuttontext(list[i].text()))
and Here Is getbuttontext function:
def getbuttontext(n):
print(n)
My Problem Is That When I Click On Any button the Function print "carrot" How To Fix It Please...