A presentation is opened using the Presentation() function, provided directly by the pptx package:

from pptx import Presentation

This function returns a Presentation object which is the root of a graph containing the components that constitute a presentation, e.g. slides, shapes, etc. All existing presentation components are referenced by traversing the graph and new objects are added to the graph by calling a method on that object’s container. Consequently, python-pptx objects are generally not constructed directly.


# load a presentation
prs = Presentation(path_to_pptx_file)

# get reference to first shape in first slide
sp = prs.slides[0].shapes[0]

# add a picture shape to slide
pic = sld.shapes.add_picture(path, x, y, cx, cy)

Presentation function

This function is the only reference that must be imported to work with presentation files. Typical use interacts with many other classes, but there is no need to construct them as they are accessed using a property or method of their containing object.


Return a Presentation object loaded from pptx, where pptx can be either a path to a .pptx file (a string) or a file-like object. If pptx is missing or None, the built-in default presentation “template” is loaded.

Presentation objects

class pptx.presentation.Presentation[source]

PresentationML (PML) presentation.

Not intended to be constructed directly. Use pptx.Presentation() to open or create a presentation.


Instance of CoreProperties holding the read/write Dublin Core document properties for this presentation.


Instance of NotesMaster for this presentation. If the presentation does not have a notes master, one is created from a default template and returned. The same single instance is returned on each call.


Save this presentation to file, where file can be either a path to a file (a string) or a file-like object.


Height of slides in this presentation, in English Metric Units (EMU). Returns None if no slide width is defined. Read/write.


Sequence of SlideLayout instances belonging to the first SlideMaster of this presentation. A presentation can have more than one slide master and each master will have its own set of layouts. This property is a convenience for the common case where the presentation has only a single slide master.


First SlideMaster object belonging to this presentation. Typically, presentations have only a single slide master. This property provides simpler access in that common case.


Sequence of SlideMaster objects belonging to this presentation


Width of slides in this presentation, in English Metric Units (EMU). Returns None if no slide width is defined. Read/write.


Slides object containing the slides in this presentation.

CoreProperties objects

Each Presentation object has a CoreProperties object accessed via its core_properties attribute that provides read/write access to the so-called core properties for the document. The core properties are author, category, comments, content_status, created, identifier, keywords, language, last_modified_by, last_printed, modified, revision, subject, title, and version.

Each property is one of three types, str, datetime.datetime, or int. String properties are limited in length to 255 characters and return an empty string (‘’) if not set. Date properties are assigned and returned as datetime.datetime objects without timezone, i.e. in UTC. Any timezone conversions are the responsibility of the client. Date properties return None if not set.

python-pptx does not automatically set any of the document core properties other than to add a core properties part to a presentation that doesn’t have one (very uncommon). If python-pptx adds a core properties part, it contains default values for the title, last_modified_by, revision, and modified properties. Client code should change properties like revision and last_modified_by explicitly if that behavior is desired.

class pptx.opc.coreprops.CoreProperties

string – An entity primarily responsible for making the content of the resource.


string – A categorization of the content of this package. Example values might include: Resume, Letter, Financial Forecast, Proposal, or Technical Presentation.


string – An account of the content of the resource.


string – completion status of the document, e.g. ‘draft’


datetime – time of intial creation of the document


string – An unambiguous reference to the resource within a given context, e.g. ISBN.


string – descriptive words or short phrases likely to be used as search terms for this document


string – language the document is written in


string – name or other identifier (such as email address) of person who last modified the document


datetime – time the document was last printed


datetime – time the document was last modified


int – number of this revision, incremented by the PowerPoint® client once each time the document is saved. Note however that the revision number is not automatically incremented by python-pptx.


string – The topic of the content of the resource.


string – The name given to the resource.


string – free-form version string