data.binary.Loader
Method
- Loader.__init__(meta)
Initialize loader.
Loaders take a ResourceDescription instance containing all the parameters needed to load and initialize this data.
- Parameters:
meta (ResourceDescription) – The resource to load
- classmethod Loader.supports_file(meta)
Check if the loader has a supported file extension.
What extensions are supported can be defined in the
file_extensions
class attribute.
- Loader.load() bytes [source]
Load a file in binary mode
- Returns:
The bytes contents of the file
- Return type:
bytes
- Loader.find_data(path)
Find resource using data finders.
This is mainly a shortcut method to simplify the task.
- Parameters:
path – Path to resource
- Loader.find_program(path)
Find resource using program finders.
This is mainly a shortcut method to simplify the task.
- Parameters:
path – Path to resource
- Loader.find_texture(path)
Find resource using texture finders.
This is mainly a shortcut method to simplify the task.
- Parameters:
path – Path to resource
- Loader.find_scene(path)
Find resource using scene finders.
This is mainly a shortcut method to simplify the task.
- Parameters:
path – Path to resource
Attributes
- Loader.kind = 'binary'
The kind of resource this loaded supports. This can be used when file extensions is not enough to decide what loader should be selected.
- Loader.file_extensions = []
A list defining the file extensions accepted by this loader.
Example:
# Loader will match .xyz and .xyz.gz files. file_extensions = [ ['.xyz'], ['.xyz', '.gz'], ]
- Loader.ctx
ModernGL context
- Type:
moderngl.Context