def draw_promotion_cover(self, canvas: BoardCanvas) -> int: img = self.board_img_cache.get_dict( board_sized=True)["semi-transparent"] id_: int id_ = canvas.create_image( *canvas.idxs_to_xy(0, 0), image=img, anchor="nw", tags="promotion_prompt", ) return id_
def draw_koma( self, canvas: BoardCanvas, x: float, y: float, ktype: KomaType, anchor: str = "center", tags: Tuple[str, ...] = ("", ), ) -> int: if ktype == KomaType.NONE: return None img = self.koma_dict[ktype] id_: int id_ = canvas.create_image(x, y, image=img, anchor=anchor, tags=tags) return id_
def draw_layer(self, canvas: BoardCanvas, tag: str = "") -> None: for row_idx in range(NUM_ROWS): for col_idx in range(NUM_COLS): id_ = canvas.create_image( *canvas.idxs_to_xy( col_idx, row_idx, centering="xy" if self.is_centered else "", ), image="", anchor="center" if self.is_centered else "nw", tags=tag, ) self.tiles[row_idx][col_idx] = id_ return