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)

create_appearance()

Returns a new appearance (Background instance or Costume instance)

next_appearance()

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)

self_remove()

Implemented in subclasses

__iter__()

__next__()

get_actual_appearance()

Private Data Attributes:

_abc_impl

Inherited from ABC

_abc_impl

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_costume and add_background in subclasses.

Return type:

Appearance

add_new_appearance_from_list(sources)[source]#
Return type:

Appearance

add_new_appearances(sources)[source]#
Return type:

None

animate(speed)[source]#
animate_appearance(appearance, speed)[source]#
property animation_speed#
property border#
abstract create_appearance()[source]#

Returns a new appearance (Background instance or Costume instance)

Return type:

Appearance

find_appearance(appearance)[source]#

Searches for appearance; returns index of appearance

Return type:

int

Returns:

Index of found appearance; -1 if appearance was not found.

Return type:

int

get_actual_appearance()[source]#
Return type:

Appearance

get_appearance_at_index(index)[source]#
Return type:

Optional[Appearance]

property image: Surface#
length()[source]#

Number of appearance in appearance manager

Return type:

int

Returns:

_description_

Return type:

int

list()[source]#

Returns all appearances in manager as list.

Return type:

List[Appearance]

Returns:

All appearances in manager as list

Return type:

List[appearance_mod.Appearance]

next_appearance()[source]#

Switches to next appearance

Return type:

Appearance

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)

reset()[source]#
self_remove()[source]#

Implemented in subclasses

Return type:

None

set_animated(value)[source]#
set_animation_speed(value)[source]#
set_border(value)[source]#
set_new_appearance(source)[source]#
set_scaled(value)[source]#
set_scaled_to_height(value)[source]#
set_scaled_to_width(value)[source]#
set_upscaled(value)[source]#
switch_appearance(source)[source]#
Return type:

Appearance