I am trying to create a simple matching game using Python 2.7 and Tkinter.
The work-in-progress source code lives here.
My problem is this particular code snippet:
for i in range(16):
self.img[i].config(command=lambda btn=self.btn[i]: \
self.show_btn(self.btn[i]))
self.btn[i].config(command=lambda btn=self.btn[i]: \
self.hide_btn(self.btn[i]))
There is an existing logic error that I cannot seem to figure out.
The thing is it only configures the last two buttons that is, img[15] and btn[15].
By the way, img and btn are two sets of Button widgets stored in a list.