This project is an implementation of the classic Minesweeper game using Python and the Tkinter library. The game follows an Object-Oriented Programming (OOP) approach and provides a graphical user interface for a more engaging experience. It also has database to record game data.
- Graphical User Interface: Built with Tkinter for a visual gaming experience.
- OOP Design: Clean and maintainable code using object-oriented principles.
- Interactive Gameplay: Left-click to reveal cells, right-click to flag mines.
- Dynamic Grid: Adjust the grid size and mine count through settings.
To run this game, you need Python installed on your system. This project does not require any external libraries beyond Tkinter, which comes pre-installed with Python.
-
Clone the repository:
git clone https://github.com/asifurrahmanbubt/Python-Tkinter-Minesweeper-OOP-Based-Game cd Minesweeper-Tkinter -
Ensure you have Tkinter installed (Tkinter is included with standard Python distributions).
-
Navigate to the project directory:
cd Minesweeper-Tkinter -
Run the game:
python main.py
main.py: Initializes the game window and main game loop.cell.py: Contains theCellclass, which represents each cell in the Minesweeper grid.settings.py: Holds the configuration settings for the game such as grid size and number of mines.utils.py: Utility functions for calculating grid dimensions.
- Start the Game: Run the
main.pyfile to open the Minesweeper window. - Reveal Cells: Left-click on a cell to reveal it.
- Flag Mines: Right-click on a cell to flag or unflag it as a mine.
- Win the Game: Reveal all non-mine cells to win. If you click on a mine, you lose.
Contributions are welcome! If you have any improvements or suggestions, feel free to fork the repository and create a pull request.
This project is open-source and available under the MIT License.