I wrote this for learning purposes. You can start a game with:
python minesweeper.py
It will open a window with a 20*20 grid and 40 mines in it. Left-click to uncover a slot or right click to mark it as a mine. If you uncover an empty slot the game will automatically uncover all surrounding slots up to the first warnings.