Appearance#
AppearanceManager is the parent-class of BackgroundManager and CostumeManager
These classes manage all appearances of an actor or world.
- class miniworlds.appearances.appearances_manager.AppearancesManager(parent)[source]#
Public Data Attributes:
Public Methods:
__init__(parent)add_new_appearance(source)Adds a new Appearance (costume or background) to manager.
set_new_appearance(source)add_new_appearances(sources)add_new_appearance_from_list(sources)Returns a new appearance (Background instance or Costume instance)
Switches to next appearance
length()Number of appearance in appearance manager
__len__()get_appearance_at_index(index)find_appearance(appearance)Searches for appearance; returns index of appearance
set_border(value)set_animated(value)set_animation_speed(value)set_upscaled(value)set_scaled_to_width(value)set_scaled_to_height(value)set_scaled(value)list()Returns all appearances in manager as list.
__str__()Return str(self).
remove_appearance([source])Removes an appearance (costume or background) from manager
reset()switch_appearance(source)animate(speed)animate_appearance(appearance, speed)Implemented in subclasses
__iter__()__next__()Private Methods:
_init_display()_create_appearance_from_source(source)_add_default_appearance()_add_first_appearance(appearance)_add_appearance_to_manager(appearance)_set_appearance_defaults()_set_all(attribute, value)Sets attribute for all appearance in manager.
_remove_appearance_from_manager(appearance)Removes appearance from manager If self.length == 1, the last costume is removed and a default appearance will be added.
- add_new_appearance(source)[source]#
Adds a new Appearance (costume or background) to manager.
called by
add_costumeandadd_backgroundin subclasses.- Return type:
- property animation_speed#
- property border#
- abstract create_appearance()[source]#
Returns a new appearance (Background instance or Costume instance)
- Return type:
- property image: Surface#
- list()[source]#
Returns all appearances in manager as list.
- Return type:
- Returns:
All appearances in manager as list
- Return type:
List[appearance_mod.Appearance]
- next_appearance()[source]#
Switches to next appearance
- Return type:
- Returns:
the switched appearance
- Return type:
appearance_mod.Appearance
- property orientation#
- remove_appearance(source=-1)[source]#
Removes an appearance (costume or background) from manager
- Defaults:
Removes last costume.
- Parameters:
source – The index of the new appearance or the Appearance which should be removed Defaults to -1
costume) ((last)