MCPcopy Create free account
hub / github.com/scanny/python-pptx / get_or_add_bgPr

Method get_or_add_bgPr

src/pptx/oxml/slide.py:107–116  ·  view source on GitHub ↗

Return `p:bg/p:bgPr` grandchild. If no such grandchild is present, any existing `p:bg` child is first removed and a new default `p:bg` with noFill settings is added.

(self)

Source from the content-addressed store, hash-verified

105 )
106
107 def get_or_add_bgPr(self) -> CT_BackgroundProperties:
108 """Return `p:bg/p:bgPr` grandchild.
109
110 If no such grandchild is present, any existing `p:bg` child is first removed and a new
111 default `p:bg` with noFill settings is added.
112 """
113 bg = self.bg
114 if bg is None or bg.bgPr is None:
115 bg = self._change_to_noFill_bg()
116 return cast(CT_BackgroundProperties, bg.bgPr)
117
118 def _change_to_noFill_bg(self) -> CT_Background:
119 """Establish a `p:bg` child with no-fill settings.

Callers 1

fillMethod · 0.80

Calls 1

_change_to_noFill_bgMethod · 0.95

Tested by

no test coverage detected