def draw_pieces(self):
self.canvas.delete('piece')
for square in chess.SQUARES:
piece = self.board.piece_at(square)
if piece is not None:
image_name = 'img/%s.png' % (piece.symbol())
piece_name = '%s%s' % (piece.symbol(), square)
if image_name not in self.icons:
image = Image.open(image_name).resize((64, 64))
self.icons[image_name] = ImageTk.PhotoImage(image)
row = square // 8
column = square % 8
self.add_piece(piece_name, self.icons[image_name], row, column)
self.place_piece(piece_name, row, column)
评论列表
文章目录