pyface.resource.resource_manager module

The default resource manager.

A resource manager locates and loads application resources such as images and sounds etc.

class pyface.resource.resource_manager.ResourceManager[source]

Bases: HasTraits

The default resource manager.

A resource manager locates and loads application resources such as images and sounds etc.

IMAGE_EXTENSIONS = ['.png', '.jpg', '.bmp', '.gif', '.ico']
locate_image(image_name, path, size=None)[source]

Locates an image.

Parameters
  • image_name (str) – Name of the image file.

  • path (list of (str or ModuleType)) – Paths from which image files will be searched. Note that for each path, a subdirectory named ‘images’ will be search first. The first match will be returned.

  • size (tuple of (m: int, n: int), optional) – Specific size of the image requested. If provided, then the subdirectory images/{m}x{n} will be searched first, followed by the images subdirectory and its containing folder. Default is None.

Returns

image_ref – ImageReference to the image found, or None if no matching images are found.

Return type

ImageReference or None

load_image(image_name, path, size=None)[source]

Loads an image.