I am working on a Project in tkinter. I am creating a multidementional list of Buttons in tkinter for a game board, and for the command atribute I am passing in a function that has a few arguments, for my arguments I am attempting to pass the spacific iteration that I am on to the attached function i.e. "i" and "j" but whenever I pass i & j it always passes in as the final iteration of the for-loop, which in this case is 3, so i & j always equate to 3 rather then the iteration on which this button was created. I have been stuck on this for awhile and the way i am populating the multi dementional array is that way because it is the only way I got the buttons to apear on the screen.
Thanks for any help!!
The Code
mSpots = [[tk.Button(gameBoard, text= str(i + 1)+ ','+ str(j +1) ,font= ("Halvetica", 7), height=3, width=6, bg= 'gray',fg='white', command= lambda: clicking(i,j,slotAvailibility))for i in range (4)] for j in range(4)]
I tried seperating the population of the multidementional list into 2 for-loops but the buttons would not come up on the GUI.
I have tried to just pass the text as the arguments because the text comes out right, but that was not working (but I am unsure if I was typing in the syntax corectly).