Tile
The tile module manages the tiles that are used to build a track.
Note
You can see all the tiles here:
linefollowtiles.pdf
Warning
The tiles 10 and 32 can not be used by Line Track Designer.
- class tile.Tile(number)
Bases:
object
Representation of a tile. An instance of the Tile class is composed of four fields:
number: number of the tile
name: name of the tile
path: path to the PNG image corresponding to the tile
image: PIL.Image format associated to the tile
- SIDE = 200
- static is_valid(number)
Return True if the number corresponds to a valid tile. It is valid if the number is between 2 and 33, and the tiles 10 and 32 are invalid.
- Parameters:
number (int) – number of a tile
- Returns:
Is a valid number
- Return type:
bool
- __init__(number)
Init a tile.
- Parameters:
number (int) – number of the tile
- Raises:
LineTrackDesignerError – invalid tile number
- property number
Get the number of the tile.
- property name
Get the name of the tile.
- property path
Get the path of the PNG image associated to the tile.
- property image
Get the image associated to the tile.
- __str__()
Make the sting format of the tile. It returns its name.
- __repr__()
Make the repr format of the tile. It’s the same than the string format.
- show(orient=0)
Show the tile in your picture viewer.
- Parameters:
orient (int) – orientation of the tile (default: 0)
- Raises:
LineTrackDesignerError – invalid orient value
- class tile.Tiles
Bases:
object
Manage all the tiles. The tiles are stocked in the dictionary dict_tiles. The keys correspond to the number of the tile and the values are the Tile objects corresponding to this number.
- __init__()
Init the tiles. It creates the dictionary dict_tiles.
- property dict_tiles
Get the dictionary of tiles.
- __str__()
Make the sting format of the tiles. It returns the names of the tiles.
- __repr__()
Make the repr format of the tiles. It’s the same than the string format.
- get_tile(number)
Get a tile from its number.
- Parameters:
number (int) – number of the tile
- Returns:
tile associated to the number
- Return type:
- Raises:
LineTrackDesignerError – tile not found
- static show()
Open the PDF file containing the tiles.
- Raises:
LineTrackDesignerError – unable to open the PDF file