LayoutShapes
paper-pptx 0.2.0 API reference
Sequence of shapes appearing on a slide layout.
The first shape in the sequence is the backmost in z-order and the last shape is topmost. Supports indexed access, len(), index(), and iteration.
Attributes
element
attributeelementThe lxml element proxied by this object.
parent
attributeparentThe ancestor proxy object to this one.
For example, the parent of a shape is generally the SlideShapes object that contains it.
part
attributepartXmlPartThe package part containing this object.
turbo_add_enabled
attributeturbo_add_enabledboolTrue if "turbo-add" mode is enabled. Read/Write.
EXPERIMENTAL: This feature can radically improve performance when adding large numbers (hundreds of shapes) to a slide. It works by caching the last shape ID used and incrementing that value to assign the next shape id. This avoids repeatedly searching all shape ids in the slide each time a new ID is required.
Performance is not noticeably improved for a slide with a relatively small number of shapes, but because the search time rises with the square of the shape count, this option can be useful for optimizing generation of a slide composed of many shapes.
Shape-id collisions can occur (causing a repair error on load) if more than one Slide
object is used to interact with the same slide in the presentation. Note that the Slides
collection creates a new Slide object each time a slide is accessed (e.g. slide = prs.slides[0], so you must be careful to limit use to a single Slide object.
Functions
__getitem__
func__getitem__(idx: int) -> BaseShapeReturn shape at idx in sequence, e.g. shapes[2].
paramidxintReturns
pptx.shapes.base.BaseShape__iter__
func__iter__() -> Iterator[BaseShape]Generate a reference to each shape in the collection, in sequence.
Returns
typing.Iterator[pptx.shapes.base.BaseShape]__len__
func__len__() -> intReturn count of shapes in this shape tree.
A group shape contributes 1 to the total, without regard to the number of shapes contained in the group.
Returns
intclone_placeholder
funcclone_placeholder(placeholder: LayoutPlaceholder) -> NoneAdd a new placeholder shape based on placeholder.
paramplaceholderLayoutPlaceholderReturns
Noneph_basename
funcph_basename(ph_type: PP_PLACEHOLDER) -> strReturn the base name for a placeholder of ph_type in this shape collection.
There is some variance between slide types, for example a notes slide uses a different name for the body placeholder, so this method can be overriden by subclasses.
paramph_typePP_PLACEHOLDERReturns
str