A modern take on the classic Snake arcade game, built with Python and Tkinter. It includes dynamic themes (Classic, Ocean, Sunset, Retro), animated title reveal, score + session high score, and a reset flow from a Game Over screen.
- 4 themes via dropdown: Classic / Ocean / Sunset / Retro
- Animated title and start prompt
- Arrow-key controls with smooth, timer-based movement
- Score + session high score (resets when the app closes)
- Reset button shown on Game Over
- Window-centering and fixed-size canvas (1000×700)
- Space — Start the game
- Arrow Keys — Move (Up/Down/Left/Right)
- Theme menu — Change theme (resets the game)
- Reset button — Appears after Game Over
Note: WASD and pause aren’t implemented in the current code.
- Python 3.8+
- Tkinter (bundled with most Python installers)
- Linux: you may need to install it separately, e.g.
sudo apt install python3-tk
- Linux: you may need to install it separately, e.g.
# 1) Clone
git clone https://github.com/your-username/snake-tkinter.git
cd snake-tkinter
# 2) Run
python snake.py
# or: python3 snake.py- Constants: tune board size, speed, and cell size at the top of
snake.py - Themes: managed by
THEMES+apply_theme(theme_name)which resets the game, recolors the canvas, and redraws the snake/food. - Game loop:
next_turn()updates the snake’s head position, handles growth when eating food, and checks collisions before scheduling the next tick. - Entities:
Snakeclass stores coordinates and canvas rectanglesFoodclass spawns a new food circle at a random grid location
- Input: Arrow keys are bound via
window.bind(...); Space starts the run. - Game Over: clears the canvas, shows a Game Over banner, and a Reset Game button that re-applies the current theme.
- Add a theme: extend
THEMES:It will automatically appear in the dropdown.THEMES["Neon"] = {"bg": "#0A0A0A", "snake": "#39FF14", "food": "#FF2079"}
- Change speed or grid: tweak
SPEEDandSPACE_SIZE. - Board size: update
GAME_WIDTH/GAME_HEIGHT.
- Pause/resume (
P) - WASD support + key repeat throttling
- Persistent high scores (JSON or SQLite)
- Sounds and music
- Difficulty levels
- Obstacles and power-ups
Made by Conor Gregson
This project is open-source and available under the MIT License. See the LICENSE file for details.
Built with Python’s standard Tkinter GUI toolkit. Inspired by the classic Snake arcade game.