The ‘Background’ class is a child classes of the ‘Appearance’ class.
Since backgrounds are bound to board, you don’t need to instantiate backgrounds objects directly. Instead use
The class describes the background of a board.
Each board has one or more backgrounds that can be switched between. In addition, each background also has several pictures between which you can switch.
You can scale a background or tile it like a texture.
Adds an image to the appearance
path – The path to the image relative to actual directory
animation – True if image should be removed after first animation
Returns: The index of the added image.
If not False, a grid overlay is drawn over the background image.
>>> a_token.background.grid_overlay = (255, 0, 0, 0) Draws a red (255, 0, 0, 0) background overlay
>>> a_token.background.grid_overlay = False Disables background grid_overlay
>>> a_token.background.grid_overlay = () Disables background grid_overlay. Same as a_token.background.grid_overlay = False
Scales the image to Tile_size.
The method is needed if you want to texture the background on a Tiled_Board and want the texture to fill one tile at a time.
Defines a textured board
>>> class MyBoard(TiledBoard): >>> def on_setup(self): >>> self.add_image(path="images/stone.png") >>> self.background.is_textured = True >>> self.background.is_scaled_to_tile = True >>> self.player = Player(position=(3, 4))
Switches to the next image of the appearance.
The parent of a Background is the associated board.