Python tkinter lambda
I've got a list of Entrys like: name, address, ... BUTTON name, address, ... BUTTON name, address, ... BUTTON .... the button is to update a table in a database. So I created a function: def updateEntry(nr, tableName, entryList): print(nr, tableName) for E in entryList: print(E) The entrys and buttons are created in a loop: while x < len(Database-entrys): entry = Entry(second_frame) .... button = Button(second_frame, command= updateEntry(nr, tableName, entryList) But the button always showed the last number - no problem: I added lambda: button = Button(..., command = lambda nr = nr, tableName = tableName, entryList = entryList: updateEntry(nr, tableName, entryList), which worked, but only for the nr! So it shows the right number, but the entryList seems not to be affected by lambda. That's the part of my code, which I'm talking about x=0 zz=30 v=0 while(x<len(result)): y=0 Eintrag = result[x] while(y<len(Eintrag)): label = Entry(second_frame) #tk label.grid(row = zz, column= y) Ein =str(Eintrag[y]) label.insert(0, Ein) labels.append(label) labelReihe.append(label) y+=1 NR = str(Eintrag[0]) print("NR = " + NR) NRList.append(NR) #lambda anpassen btn_update = Button(second_frame, text="update", command = \ lambda NR=NR, tableName = tableName, labelReihe=labelReihe: updaten(NR, tableName, labelReihe)) btn_update.grid(row = zz, column = y+1) btnList.append(btn_update) btn_delete = Button(second_frame, text="delete", command = lambda NR = NR: deleten(NR)) btn_delete.grid(row = zz, column = y + 2) btnList.append(btn_delete) for L in labelReihe: print(L) del labelReihe[:] v+