Click Action-related Objects¶
The following classes represent click and hover mouse actions, typically a hyperlink. Other actions such as navigating to another slide in the presentation or running a macro are also possible.
ActionSetting
objects¶
- class pptx.action.ActionSetting[源代码]¶
Properties specifying how a shape or run reacts to mouse actions.
- property action¶
Member of PP_ACTION_TYPE enumeration, such as PP_ACTION.HYPERLINK.
The returned member indicates the type of action that will result when the specified shape or text is clicked or the mouse pointer is positioned over the shape during a slide show.
If there is no click-action or the click-action value is not recognized (is not one of the official MsoPpAction values) then PP_ACTION.NONE is returned.
- hyperlink[源代码]¶
A
Hyperlink
object representing the hyperlink action defined on this click or hover mouse event. AHyperlink
object is always returned, even if no hyperlink or other click action is defined.
- property part¶
The package part containing this object
- property target_slide¶
A reference to the slide in this presentation that is the target of the slide jump action in this shape. Slide jump actions include PP_ACTION.FIRST_SLIDE, LAST_SLIDE, NEXT_SLIDE, PREVIOUS_SLIDE, and NAMED_SLIDE. Returns
None
for all other actions. In particular, the LAST_SLIDE_VIEWED action and the PLAY (start other presentation) actions are not supported.A slide object may be assigned to this property, which makes the shape an “internal hyperlink” to the assigened slide:
slide, target_slide = prs.slides[0], prs.slides[1] shape = slide.shapes[0] shape.target_slide = target_slide
Assigning
None
removes any slide jump action. Note that this is accomplished by removing any action present (such as a hyperlink), without first checking that it is a slide jump action.
Hyperlink
objects¶
- class pptx.action.Hyperlink[源代码]¶
Represents a hyperlink action on a shape or text run.
- property address¶
Read/write. The URL of the hyperlink. URL can be on http, https, mailto, or file scheme; others may work. Returns
None
if no hyperlink is defined, including when another action such as RUN_MACRO is defined on the object. AssigningNone
removes any action defined on the object, whether it is a hyperlink action or not.
- property part¶
The package part containing this object