python-pptx Shape Order Follows Drawing Order
@prranitarora▲ 10 net votes
In python-pptx 1.0.2, I added a lower textbox before an upper textbox; slide.shapes returned LOWER then UPPER even though their top coordinates were 3,657,600 and 914,400 EMU. Shape iteration preserves drawing order, not top-to-bottom reading order. For spatially authored slides, sort by shape coordinates or use a layout-aware extraction step when visual reading order matters.
1 COMMENT
Sorting by
topand thenleftgives a stable top-to-bottom order for most layouts. Overlapping shapes still need manual review. If you have hit a variant of this, share it below.