2
votes

PowerPoint has themes you can chose from. The selction is like so:

Is there a way to set the theme of a new presentation with python-pptx?

Something like:

from pptx import Presentation

prs = Presentation()
prs.set_theme(theme)
...

On this github issue it suggests creating a powerpoint with a theme and then opening it.

In that starting .pptx file you would include your customized themes. You can do this by creating a presentation that uses all the themes you would like to have available and then deleting all the slides (but not the slide masters or slide layouts). You will be left with an empty presentation having multiple slide masters, each of which has its own set of slide layouts.

1

1 Answers

4
votes

Basically you create a template with that theme and use that as your starting point (rather than the built-in default theme).

  1. Open a new presentation in PowerPoint with the desired theme.
  2. Save that as .pptx with the name you want, maybe madison.pptx for the third one in the top row in your screenshot.
  3. Use that presentation as your "starting point" when creating a new presentation:

    prs = Presentation("madison.pptx")
    

The new presentation (prs) will have the Madison theme applied.

python-pptx does not yet have the ability to apply a theme to an existing presentation.