https://github.com/h-a-y-k/hichesslib
hichesslib is a cross-platform Python GUI chess library.
https://github.com/h-a-y-k/hichesslib
chess pyside2 python-chess python3 python36 python37 qt
Last synced: 12 months ago
JSON representation
hichesslib is a cross-platform Python GUI chess library.
- Host: GitHub
- URL: https://github.com/h-a-y-k/hichesslib
- Owner: H-a-y-k
- License: gpl-3.0
- Created: 2020-06-24T13:41:04.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-07-16T21:09:31.000Z (almost 2 years ago)
- Last Synced: 2025-04-08T17:46:00.098Z (about 1 year ago)
- Topics: chess, pyside2, python-chess, python3, python36, python37, qt
- Language: Python
- Homepage:
- Size: 13.8 MB
- Stars: 10
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# hichesslib
[](https://pypi.org/project/hichesslib/) [](https://app.travis-ci.com/H-a-y-k/hichesslib) [](https://coveralls.io/github/H-a-y-k/hichesslib?branch=master)
## Description
hichesslib is a cross-platform Python GUI chess library based on [python-chess](https://pypi.org/project/python-chess/) and [PySide2](https://pypi.org/project/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.
## Dependencies
Requires python version >= 3.6. For other dependencies see [requirements file](https://github.com/H-a-y-k/hichesslib/blob/master/requirements.txt).
## Usage
### Installation
> git clone https://github.com/H-a-y-k/hichesslib
>
> cd hichesslib
>
> python3 -m pip install -r --requirements.txt
### Initialization
To start using the library you need to create a PySide2 application. The library's widgets can be used like any Qt widget.
``` python
>>> 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_())
```
### Features
#### CellWidget
* 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
* 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).
### Documentation
The the documentation is located in [docs](https://github.com/H-a-y-k/hichesslib/tree/master/docs).
### Problems and limitations
* In order to make CellWidget graphically customizable, after each property change, the methods [unpolish](https://doc.qt.io/qt-5/qstyle.html#unpolish) and [polish](https://doc.qt.io/qt-5/qstyle.html#polish) are called, which significantly slows down the interactions with CellWidget.
### Examples
See [examples folder](https://github.com/H-a-y-k/hichesslib/tree/master/examples).
## Status
The library has been tested on Windows7, Windows10, Fedora 31.
## Tests
Unittests are done with the [unittest](https://docs.python.org/3/library/unittest.html) framework.
Tests are located in [hichesslib/test/](https://github.com/H-a-y-k/hichesslib/tree/master/test).
## License
hichesslib is licensed under GPLv3.0+ license. See [license](https://github.com/H-a-y-k/hichesslib/blob/master/LICENSE) file.