ShapeCollection

Overview

ShapeCollection is a class in Aspose.Slides FOSS for Python. Inherits from: BaseCollection, IShapeCollection.

Represents a collection of shapes.

This class declares 36 methods for ShapeCollection objects in Python programs. Available methods include: __contains__, __getitem__, __init__, __iter__, __len__, add_auto_shape, add_chart, add_connector, add_group_shape, add_picture_frame, add_table, clear, and 10 additional methods. Public members are accessible to any Python application after installing the Aspose.Slides FOSS for Python package. Properties: as_i_collection, as_i_enumerable, length, parent_group.

Properties

NameTypeAccessDescription
parent_groupIGroupShapeReadGets the parent group shape object for the shapes collection.
as_i_collectionlistReadGets the as i collection.
as_i_enumerableAnyReadGets the as i enumerable.
lengthintReadReturns the number of elements.

Methods

SignatureDescription
__init__()Initialize an empty shape collection.
__len__() → intReturn the number of shapes in the collection.
__iter__()Iterate over shapes in the collection.
to_array() → list[IShape]Convert the collection to an array.
reorder()Reorder shapes in the collection.
add_auto_shape() → IAutoShapeAdds a new IAutoShape to the collection
insert_auto_shape() → IAutoShapeInserts a new IAutoShape at a specific position
add_connector() → IConnectorAdds a new IConnector shape to the collection
insert_connector() → IConnectorInserts a new IConnector at a given index
add_group_shape() → IGroupShapeAdd a new GroupShape to the collection.
index_of(shape: IShape) → intReturn the zero-based index of the specified shape.
add_picture_frame(shape_type, x, y, width, height, image) → IPictureFrameAdds an IPictureFrame with given type, position, size, and image
insert_picture_frame(index, shape_type, x, y, width, height, image) → IPictureFrameInserts an IPictureFrame at index with given parameters
add_chart()Add a chart to the slide.
insert_chart()Insert a chart at a specific index.
add_table(x, y, column_widths, row_heights) → ITableAdds an ITable at position with column widths and row heights
insert_table(index, x, y, column_widths, row_heights) → ITableInserts an ITable at index with position and dimensions
remove_at(index: int)Remove the shape at the specified index.
remove(shape: IShape)Remove the specified shape from the collection.
clear()Remove all shapes from the collection.
__getitem__(index: int) → IShapeGet the shape at the specified index.
__contains__(item) → boolCalls contains(item) on this ShapeCollection instance.
to_array(start_index, count) → list[IShape]Converts the collection to a list of IShape objects
reorder(index, shape)Reorders the shapes within the collection
add_auto_shape(shape_type, x, y, width, height) → IAutoShapeCalls add_auto_shape(shape_type, x, y, width, height) on this ShapeCollection instance.
add_auto_shape(shape_type, x, y, width, height, create_from_template) → IAutoShapeCalls add_auto_shape(shape_type, x, y, width, height, create_from_template) on this ShapeCollection instance.
insert_auto_shape(index, shape_type, x, y, width, height) → IAutoShapeCalls insert_auto_shape(index, shape_type, x, y, width, height) on this ShapeCollection instance.
insert_auto_shape(index, shape_type, x, y, width, height, create_from_template) → IAutoShapeCalls insert_auto_shape(index, shape_type, x, y, width, height, create_from_template) on this ShapeCollection instance.
add_connector(shape_type, x, y, width, height) → IConnectorCalls add_connector(shape_type, x, y, width, height) on this ShapeCollection instance.
add_connector(shape_type, x, y, width, height, create_from_template) → IConnectorCalls add_connector(shape_type, x, y, width, height, create_from_template) on this ShapeCollection instance.
insert_connector(index, shape_type, x, y, width, height) → IConnectorCalls insert_connector(index, shape_type, x, y, width, height) on this ShapeCollection instance.
insert_connector(index, shape_type, x, y, width, height, create_from_template) → IConnectorCalls insert_connector(index, shape_type, x, y, width, height, create_from_template) on this ShapeCollection instance.
add_group_shape(svg_image, x, y, width, height) → IGroupShapeAdds a new IGroupShape (group) to the collection
index_of(shape) → intReturns the zero‑based index of the specified IShape
remove_at(index)Removes the shape at the specified index
remove(shape)Removes the given IShape from the collection

See Also

 English