#StackBounty: #python #svg #python-chess Get Location of Piece in Python-Chess

Bounty: 50

I am currently building a chess game using Python-Chess, and I am trying to use the SVG module to generate SVG images of the board. One of the parameters for generating an svg is check (here), which is a "square to be marked indicating a check". However, from the docs, I couldn’t find a way to figure out where the player’s king is.

What I want to happen is, whenever board.is_check() I want it to generate the svg with check=, using the current location of the current player’s king. How do I figure this out? Do I have to iterate through every square and check what piece is on there until I find the correct king? Or is there a function for this that I didn’t see? Any help is appreciated, Thanks in advance!

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.