Skip to content
Advertisement

Python PPTX workaround to add Transitions to slides

I successfully automated the creation of pptx presentations using python-pptx, customising background, inserting text, images, etc.

How can I add custom Transitions to my slides? (E.g. “Transitions” > “Fade” from PowerPoint). As I could not find a function, my idea is to use workaround functions (going deep into xml): where do I start?

python 3.10.4, PowerPoint v16.54, MacOS Big Sur 11.6

enter image description here

Advertisement

Answer

So, on playing with this, the following worked for me:

JavaScript

Where slide is the slide object in python-pptx.

You probably need the following import:

JavaScript

Where I have ripple I first tested with reveal – and that worked as well. I’m sure there are other transitions. Before I attempt to add them to md2pptx I will want to find some more and figure out what kind of UI I want to surface them with.

Hope this helps.

(Edited for grammar.)

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement