Search code examples
pythonpython-pptxpython-os

How to open a pptx file in powerpoint using python?


I am developing a desktop application that helps users create Powerpoint Presentations. After finishing and saving the .pptx file, is there a way to get it to open in powerpoint so that the user can see the resulting presentation without having to open the file on their own ? (I am using windows)


Solution

  • You can use os.startfile function, which will start a file with its associated application. This will behave like double-clicking the file in Windows Explorer

    >>> import os
    >>> os.startfile("path_of_your_ppt")