A Python chess GUI application using pygame and python-chess with Stockfish support
Project description
Python Chess GUI
A Python chess application with a graphical user interface built using pygame and python-chess library, featuring player vs Stockfish AI gameplay.
Features
- Player vs Stockfish AI gameplay
- Color selection (play as White or Black)
- Adjustable AI difficulty (Level 1-5)
- Move takeback (undo)
- Hint system (get Stockfish's suggested move)
- Real-time evaluation bar
- Visual highlights for legal moves, last move, and check
Requirements
- Python 3.12+
- Stockfish engine
Installation
Option 1: Install from PyPI (recommended)
pipx install python-chess-gui
Or with pip in a virtual environment:
python -m venv venv
source venv/bin/activate # On Linux/macOS
pip install python-chess-gui
Option 2: Install from source
-
Clone the repository:
git clone git@github.com:Bobain/python-chess-gui.git cd python-chess-gui
-
Install dependencies with uv:
uv sync
Install Stockfish
- macOS:
brew install stockfish - Linux:
sudo apt install stockfish
Alternatively, set the STOCKFISH_PATH environment variable to the full path of the Stockfish executable:
export STOCKFISH_PATH=/path/to/stockfish
Usage
Run the application:
chess-gui
Or if installed from source with uv:
uv run chess-gui
Controls
- Mouse click: Select piece / move piece / menu selection
- H: Get a hint (Stockfish's suggested move)
- Z: Undo last move
- N: New game (return to menu)
- Q / Escape: Quit
Project Structure
python-chess-gui/
├── src/
│ └── python_chess_gui/
│ ├── __init__.py
│ ├── main.py
│ ├── constants.py
│ ├── coordinate_converter.py
│ ├── chess_board_renderer.py
│ ├── game_state_manager.py
│ ├── user_input_handler.py
│ ├── stockfish_engine_controller.py
│ ├── game_status_display.py
│ ├── evaluation_bar_renderer.py
│ └── game_settings_menu.py
├── pyproject.toml
├── README.md
└── .gitignore
Development
This project uses:
- uv for dependency management
- pygame for the graphical interface
- python-chess for chess logic and Stockfish communication
License
MIT License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_chess_gui-0.1.1.tar.gz.
File metadata
- Download URL: python_chess_gui-0.1.1.tar.gz
- Upload date:
- Size: 133.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08a0c8abe537e41d1498e814e7f0f8eaa52d14a19eb6ea7c3c1fbb7011c86ab0
|
|
| MD5 |
b558ededfd51816b18b5f7f38413559f
|
|
| BLAKE2b-256 |
89314fed91dfe56a6b346f2e1444f45e699c1640c002c668bf55bd479418fbce
|
Provenance
The following attestation bundles were made for python_chess_gui-0.1.1.tar.gz:
Publisher:
publish.yml on Bobain/python-chess-gui
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_chess_gui-0.1.1.tar.gz -
Subject digest:
08a0c8abe537e41d1498e814e7f0f8eaa52d14a19eb6ea7c3c1fbb7011c86ab0 - Sigstore transparency entry: 869354869
- Sigstore integration time:
-
Permalink:
Bobain/python-chess-gui@10a216c14b504ee678a25373d3e807536151948f -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Bobain
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@10a216c14b504ee678a25373d3e807536151948f -
Trigger Event:
release
-
Statement type:
File details
Details for the file python_chess_gui-0.1.1-py3-none-any.whl.
File metadata
- Download URL: python_chess_gui-0.1.1-py3-none-any.whl
- Upload date:
- Size: 23.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c76201a99d025e0b7336477a8d4810288f83268661b247273322f564458cc65a
|
|
| MD5 |
37cfdc5c16f6f3812289c8c4a79bd2bb
|
|
| BLAKE2b-256 |
22c0eed454714fc05feed0532faba7d0343ea30f99f39f0082d22bd80b6847e3
|
Provenance
The following attestation bundles were made for python_chess_gui-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on Bobain/python-chess-gui
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_chess_gui-0.1.1-py3-none-any.whl -
Subject digest:
c76201a99d025e0b7336477a8d4810288f83268661b247273322f564458cc65a - Sigstore transparency entry: 869354875
- Sigstore integration time:
-
Permalink:
Bobain/python-chess-gui@10a216c14b504ee678a25373d3e807536151948f -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Bobain
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@10a216c14b504ee678a25373d3e807536151948f -
Trigger Event:
release
-
Statement type: