The code below illustrates a buffer which displays with pygame.image.frombuffer but not with tkinter PhotoImage
import chess, chess.svg, pylunasvg as pl
from tkinter import Tk, PhotoImage
# This is where I create the buffer
board = chess.Board(chess.STARTING_FEN)
svg_text = chess.svg.board(board, size=400)
document = pl.Document.loadFromData(svg_text)
byts = bytes(document.renderToBitmap())
#Now that I have this raster buffer 'byts'
surf = pygame.image.frombuffer(byt, (400, 400), 'RGBA') #works
root = Tk()
PhotoImage(data=byt) #raises an error about the image
I know this is as a result of something I don't know about tkinter. I would really appreciate that you point out what is wrong and what I can do. Thanks in advance