hichesslib is a cross-platform Python GUI chess library based on python-chess and PySide2. The library comes with a board widget that supports the chess rules and provides a set of interactions with the cells of the board and with the board itself including drag and drop, cell marking, piece movement, board flipping and more.
Requires python version >= 3.6. For other dependencies see requirements file.
git clone https://github.com/H-a-y-k/hichesslib
cd hichesslib
python3 -m pip install -r --requirements.txt
To start using the library you need to create a PySide2 application. The library's widgets can be used like any Qt widget.
>>> import hichess
>>> from PySide2.QtWidgets import QApplication
>>> import sys
>>>
>>> if __name__ == "__main__":
... app = QApplication(sys.argv)
... boardWidget = hichess.BoardWidget()
... boardWidget.show()
... sys.exit(app.exec_())
- CellWidget can contain any chess piece.
- Can be marked. Marked cell widgets are easily customizable.
- Can be highlighted to display the legal moves on the board.
- BoardWidget supports all the chess rules.
- Is easily customizable.
- Supports rotation.
- Supports drag and drop.
- Games are easily traversable.
- Interactions can be limited to only one side or for all sides (the latter is for read only boards).
- Notifies about the game status (draw/stalemate/checkmate).
The the documentation is located in docs.
- In order to make CellWidget graphically customizable, after each property change, the methods unpolish and polish are called, which significantly slows down the interactions with CellWidget.
See examples folder.
The library has been tested on Windows7, Windows10, Fedora 31.
Unittests are done with the unittest framework. Tests are located in hichesslib/test/.
hichesslib is licensed under GPLv3.0+ license. See license file.