After alot of research including on on stackoverflow i really can't understand why the code below does not work even after i set the Default value of my variable as alot of people recomended. here is the code
#initial nested array
outter = [["name1",1],["name2",2],["name3",3]]
for inner in outter:
button = QPushButton()
button.setText(inner[0]) // create a button with the text
button.clicked.connect(lambda value=inner[1] : print(value))
The 3 buttons are created each with its respective name ( name1,name2,name3) but when i click them, it prints
False
False
False
If i change this part of the code, all 3 buttons print the last value "3", as shown below,
button.clicked.connect(lambda : print(inner[1]))
3
3
3
I already tried doing all sorts crazy things to make this work, any advices?