Reputation: 75
I'm working with pptx-python and i want to set the default size of an slide to the panoramic size (16:9). By now i can only create slides with a size of 4:3, the default one. How can i change the size of a slide?
I tried by accessing to width an height attributes of the slide, but the object Slide doesn't have any of those attributes.
presentation = Presentation()
title_only_slide_layout = presentation.slide_layouts[5]
slide = presentation.slides.add_slide(title_only_slide_layout)
print(slide.height)
AttributeError: 'SlideShapes' object has no attribute 'height'
Upvotes: 3
Views: 5924
Reputation: 375
The documentation found here python-pptx Documentation states that the "Presentation" object has the attribute "slide_height", but I did not see any documentation on "Slide" objects having the attribute height. Instead, it seems that the "Slide" inherits the height and width from "Presentation".
Try changing your print statement to the following.
print(presentation.slide_height)
Upvotes: 3