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+
  • uv (package manager)
  • Stockfish engine

Installation

  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
    
  3. 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:

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.0.tar.gz (133.4 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.0-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

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

Hashes for python_chess_gui-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2ace9c0c795013e5559758fdb974dbe8acaf5a9f9bc4b3c4f507791fe89c7888
MD5 133cd6b6660b8b36c3cf92f49e58ec7d
BLAKE2b-256 039f64685e56791d1c60a168dcc27fd6741bc0f6a71d31463815f05a20bb26c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_chess_gui-0.1.0.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.0-py3-none-any.whl.

File metadata

File hashes

Hashes for python_chess_gui-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f8d95ebeb7cd92c5c559f7189a4f5a6879883e45ed4d650df0594cc1afa167af
MD5 44cea47de032d6c6d352a2c304fe7804
BLAKE2b-256 a7b36ee95baf2c4ffccbce8b4ca39d4c276bef85b3f55eef689b6f1c80e1140e

See more details on using hashes here.

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

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