I really need help in some parts of my minesweeper code using Tkinter. I don´t have much experience in python and I am facing two major problems that I just can´t solve. The first one is that, as I generate buttons dynamically, they all have the same name and receive the same variable in the textvar option. Because of that I am not able to change the image presented on the button. The only button I am able to change this way is the last one, obviously wrong...
The other problem is that i am not finding a way to make this:
When you click a button there are three option, there may be a bomb what will bring the game to an end, there may be bombs in the eight buttons around the one clicked and then a number will be shown in it, or (and here is my problem) if there are neither bombs in the button nor in the eight other, the program should "open" buttons in all directions until the button you clicked is surrounded by numbers or borders. How is the most efficient way to do that?

8 Years
Discussion Span
Last Post by strider1066

Your project sounds like fun. rather than using buttons you might explore the canvas widget. I find that the canvas is more flexible than working with buttons/frames.

With buttons you can use pack|pack_forget to display and hide them but I can't think of a way to stack images.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.