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+
- uv (package manager)
- Stockfish engine
Installation
-
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_PATHenvironment variable to the full path of the Stockfish executable:export STOCKFISH_PATH=/path/to/stockfish
- macOS:
Usage
Run the application:
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.0.tar.gz.
File metadata
- Download URL: python_chess_gui-0.1.0.tar.gz
- Upload date:
- Size: 133.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ace9c0c795013e5559758fdb974dbe8acaf5a9f9bc4b3c4f507791fe89c7888
|
|
| MD5 |
133cd6b6660b8b36c3cf92f49e58ec7d
|
|
| BLAKE2b-256 |
039f64685e56791d1c60a168dcc27fd6741bc0f6a71d31463815f05a20bb26c3
|
Provenance
The following attestation bundles were made for python_chess_gui-0.1.0.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.0.tar.gz -
Subject digest:
2ace9c0c795013e5559758fdb974dbe8acaf5a9f9bc4b3c4f507791fe89c7888 - Sigstore transparency entry: 869342539
- Sigstore integration time:
-
Permalink:
Bobain/python-chess-gui@9a01835118e92dc67d10c3f4832b5c59523e99dc -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Bobain
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9a01835118e92dc67d10c3f4832b5c59523e99dc -
Trigger Event:
release
-
Statement type:
File details
Details for the file python_chess_gui-0.1.0-py3-none-any.whl.
File metadata
- Download URL: python_chess_gui-0.1.0-py3-none-any.whl
- Upload date:
- Size: 23.5 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 |
f8d95ebeb7cd92c5c559f7189a4f5a6879883e45ed4d650df0594cc1afa167af
|
|
| MD5 |
44cea47de032d6c6d352a2c304fe7804
|
|
| BLAKE2b-256 |
a7b36ee95baf2c4ffccbce8b4ca39d4c276bef85b3f55eef689b6f1c80e1140e
|
Provenance
The following attestation bundles were made for python_chess_gui-0.1.0-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.0-py3-none-any.whl -
Subject digest:
f8d95ebeb7cd92c5c559f7189a4f5a6879883e45ed4d650df0594cc1afa167af - Sigstore transparency entry: 869342541
- Sigstore integration time:
-
Permalink:
Bobain/python-chess-gui@9a01835118e92dc67d10c3f4832b5c59523e99dc -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Bobain
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9a01835118e92dc67d10c3f4832b5c59523e99dc -
Trigger Event:
release
-
Statement type: