Resources
- arcade.resources.resolve_resource_path(path: str | Path) Path [source]
Attempts to resolve a path to a resource including resource handles.
If the path is a string it tries to resolve it as a resource handle or convert it to a Path object.
If the path is a Path object it will
Path.resolve()
it unless it’s not absolute and return it.Example:
resolve(":resources:images/cards/cardBack_blue1.png") resolve(":my_handle:music/combat.wav")
- Parameters:
path – A Path or string
- arcade.resources.resolve(path: str | Path) Path [source]
Attempts to resolve a path to a resource including resource handles.
If the path is a string it tries to resolve it as a resource handle or convert it to a Path object.
If the path is a Path object it will
Path.resolve()
it unless it’s not absolute and return it.Example:
resolve(":resources:images/cards/cardBack_blue1.png") resolve(":my_handle:music/combat.wav")
- Parameters:
path – A Path or string
- arcade.resources.add_resource_handle(handle: str, path: str | Path) None [source]
Add a resource handle or path to an existing handle.
A handle can point to multiple paths. If a resource is not found in the first path, it will look in the next path, and so on. The search is done in reverse order, so the last path added is searched first.
- Parameters:
handle – The name of the handle
path – The absolute path to a directory
- arcade.resources.get_resource_handle_paths(handle: str) list[Path] [source]
Returns the paths for a resource handle.
- Parameters:
handle – The name of the handle
- arcade.resources.list_built_in_assets(*, name: str | None = None, extensions: Sequence[str] | None = None) list[Path] [source]
List built in assets in arcade.
This will traverse the assets directory returning a list of resources optionally filtered by name and file extensions.
Example:
# Get all assets list_built_in_assets() # Only get .png files list_built_in_assets(extensions=(".png",)) # Get all card images list_built_in_assets(name="card", extensions=(".png", ".jpg"))
- Parameters:
name – Include only assets that contain this string in the filename
extensions – A tuple of file extensions to filter by
- Returns:
A list of absolute paths to requested assets
- arcade.resources.load_kenney_fonts() None [source]
Loads all the Kenney.nl fonts bundled with Arcade.
Tip
This function is best for prototyping and experimenting!
For best performance, you may want to switch to
arcade.load_font
before release.Please see Kenney TTFs for previews and license information. The filename to load and
font_name
to use when drawing text are summarized below:font_name
forarcade.Text
"Kenney Blocks"
:resources:fonts/ttf/Kenney/Kenney_Blocks.ttf
"Kenney Future"
:resources:fonts/ttf/Kenney/Kenney_Future.ttf
"Kenney Future Narrow"
:resources:fonts/ttf/Kenney/Kenney_Future_Narrow.ttf
"Kenney High"
:resources:fonts/ttf/Kenney/Kenney_High.ttf
"Kenney High Square"
:resources:fonts/ttf/Kenney/Kenney_High_Square.ttf
"Kenney Mini"
:resources:fonts/ttf/Kenney/Kenney_Mini.ttf
"Kenney Mini Square"
:resources:fonts/ttf/Kenney/Kenney_Mini_Square.ttf
"Kenney Pixel"
:resources:fonts/ttf/Kenney/Kenney_Pixel.ttf
"Kenney Pixel Square"
:resources:fonts/ttf/Kenney/Kenney_Pixel_Square.ttf
"Kenney Rocket"
:resources:fonts/ttf/Kenney/Kenney_Rocket.ttf
"Kenney Rocket Square"
:resources:fonts/ttf/Kenney/Kenney_Rocket_Square.ttf
- arcade.resources.load_liberation_fonts() None [source]
Loads all styles for generic Arial, Courier, and Times New Roman replacements.
Tip
This function is best for prototyping and experimenting!
For best performance, you may want to switch to
arcade.load_font
before release.The Liberation fonts are proven, permissively-licensed fonts.[ For previews and additional information, please see Liberation TTFs.
font_name
values forarcade.Text
Proprietary Font(s)
Liberation Replacemetn
"Courier"
"Liberation Mono"
"Times New Roman"
,"Times"
"Liberation Serif"
"Arial"
"Liberation Sans"