A list that supports indexing by element name, as a convenience, etc
lst[some_name] means the first element where element.name == some_name. The dict-like get method is provided.
Additionally, NamedElementList subclasses can use several hooks to control how their elements are stored or what is allowed as elements.
Same as list.insert, except indices may be names instead of ints.
Insert the new value after the position specified by index_or_name
For numerical indexes, the same as insert(index + 1, value). Useful when indexing by strings.
Move an item by the specified number of indexes
amount can be negative. For example, “move layer down” translates to layers.move(idx, -1)
The method will clamp out-of range amounts, so, for eample, lst.move(0, -1) will do nothing.
Hooks for subclasses:
- modification_context(*args, **kwds)[source]¶
Context in which all modifications take place.
The default implementation nullifies the modifications if an exception is raised.
Note that the manager may nest, in which case the outermost one should be treated as an atomic operation.
Create a class that provides “unpacked” attributes for a tuple attr.
Provides x, y properties.
Subclasses will need a pos property, a 2-tuple of values.
Note: setting one of the provided properties will set pos to a new tuple.
Provides pixel_x, pixel_y properties.
Subclasses will need a pixel_pos property, a 2-tuple of values.
Note: setting one of the provided properties will set pixel_pos to a new tuple.
Provides pixel_width, pixel_height properties.
Subclasses will need a pixel_size property, a 2-tuple of values.
Note: setting one of the provided properties will set pixel_size to a new tuple.
Provides tile_width, tile_height properties.
Subclasses will need a tile_size property, a 2-tuple of values.
Note: setting one of the provided properties will set tile_size to a new tuple.
Provides a map attribute extracted from the object’s layer.
Bases: tmxlib.helpers.SizeMixin, tmxlib.helpers.PixelSizeMixin, tmxlib.helpers.PixelPosMixin, tmxlib.helpers.PosMixin, tmxlib.helpers.LayerElementMixin
Provides size based on pixel_size and the map
See the superclasses.