def initUI(self):
self.setWindowTitle(self.title)
self.setGeometry(self.left, self.top, self.width, self.height)
x=1
for index, row in self.database.iterrows():
button=QPushButton(row['Usernames'],self)
button.move(10,40*x)
print(row['Usernames'])
button.clicked.connect(lambda:self.copy(row['Usernames']))
button=QPushButton('password',self)
button.move(200,40*x)
button.clicked.connect(lambda:self.fetch_password(row['Usernames']))
x+=1
In the above code I try to create a button for each row of dataframe. The problem is that each button click is doing what the click for last row 's button. I guess same instance of QPushButton gets linked to most recent row. Buttons are created with proper name but events occur as per last row only. How do I get around this problem?