Skip to main content

A Python chess GUI application using pygame and python-chess with Stockfish support

Project description

Python Chess GUI

Demo

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

  1. Clone the repository:

    git clone git@github.com:Bobain/python-chess-gui.git
    cd python-chess-gui
    
  2. 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

python_chess_gui-0.1.1.tar.gz (133.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_chess_gui-0.1.1-py3-none-any.whl (23.6 kB view details)

Uploaded Python 3

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

Hashes for python_chess_gui-0.1.1.tar.gz
Algorithm Hash digest
SHA256 08a0c8abe537e41d1498e814e7f0f8eaa52d14a19eb6ea7c3c1fbb7011c86ab0
MD5 b558ededfd51816b18b5f7f38413559f
BLAKE2b-256 89314fed91dfe56a6b346f2e1444f45e699c1640c002c668bf55bd479418fbce

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_chess_gui-0.1.1.tar.gz:

Publisher: publish.yml on Bobain/python-chess-gui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file python_chess_gui-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for python_chess_gui-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c76201a99d025e0b7336477a8d4810288f83268661b247273322f564458cc65a
MD5 37cfdc5c16f6f3812289c8c4a79bd2bb
BLAKE2b-256 22c0eed454714fc05feed0532faba7d0343ea30f99f39f0082d22bd80b6847e3

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page