Oct-05-2019, 02:45 PM
for y in range(0, pnumplayers):#third list of hands_inputs filled with fold button self.hands_inputs[2].append(Button(self.window, text='Fold', command = lambda: pplayers[y].fold(self.hands_inputs[0:3])))In the above extract of my code I'm trying to fill a list of length
pnumplayerwith tkinter button to then show them in window i previously created. The problem I encountered is that when I assign the function that's called when the button is pressed i want to assign different function to every button using this instruction:
pplayers[y].fold(self.hands_inputs[0:3])where
pplayersis an array of object of type player I prevously created and at each button I want to assing the function fold for each player, however when I click on a given button it execute the same function though I checked and the string id of the commands are all different. Someone know how to solve this issue? Thanks in advance.