I'm trying to get this code sample from python-chess SVG rendering working.
import chess
import chess.svg
chess.svg.piece(chess.Piece.from_symbol("R"))
When I run the code, I get the following HTML output, but not the image of a white rook.
<svg version="1.1" viewBox="0 0 45 45" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g class="white rook" fill="#fff" fill-rule="evenodd" id="white-rook" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"><path d="M9 39h27v-3H9v3zM12 36v-4h21v4H12zM11 14V9h4v2h5V9h5v2h5V9h4v5" stroke-linecap="butt" /><path d="M34 14l-3 3H14l-3-3" /><path d="M31 17v12.5H14V17" stroke-linecap="butt" stroke-linejoin="miter" /><path d="M31 29.5l1.5 2.5h-20l1.5-2.5" /><path d="M11 14h23" fill="none" stroke-linejoin="miter" /></g></svg>
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>
CodePudding user response:
This resolved my problem:
import chess
import chess.svg
import IPython
html_code = chess.svg.piece(chess.Piece.from_symbol("R"))
display(IPython.display.HTML(html_code))
and now the white rook is displayed in Colab.