The title of a slide (slide.shapes.title
) is a placeholder shape. The characteristics of the text (position, text-size, alignment, etc.) placed into that shape with title.text
is determined by the placeholder. The title placeholder on the slide is "cloned" from the title placeholder on the slide-layout it is created from.
So if you change the formatting of the title placeholder on the slide-layout you create the slide from, those changes will be reflected on that slide and any others you create from that layout.
In this case, you are using the default template built into python-pptx
. That template is a 4 x 3 template which is why the title looks somewhat oddly placed when displayed in 16 x 9 (wide, HD) size. Because that template is built-in, you cannot readily change the slide layouts it contains.
The solution is to use your own starting template like:
prs = Presentation("my-blank-presentation.pptx")
Then you can use PowerPoint to adjust those slide layouts to suit, including the paragraph alignment and placeholder position.
To create such a template just create a PowerPoint presentation that looks the way you want, delete all the slides it contains (but not the slide master or slide layouts) and save it as a convenient name like my-blank-presentation.pptx
.