gui.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:yachess 作者: devinalvaro 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号