1

I'm trying to show multiple pictures of games as buttons with their name above in for loop but no matter which button I click it calls the function self.show_game_info(gameName, img) with the variables of the last button I inserted

     buttons = []
     for i in range(int(self.howManyGames)):
        // code
        button = Button(showGamesFrame, image=tkImg, command=lambda: self.show_game_info(gameName, img))
        button.image = tkImg
        row = 1
        col = i % 4
        if i > 3:
            row = 3
        button.grid(row=row, column=col)
        buttons.append(button)
        gui.entranceLabelDesign(showGamesFrame, gameName, row - 1, col,self.HEIGHT // 4)

0 Answers0