MCPcopy Index your code
hub / github.com/python-openxml/python-docx / add_drawing

Method add_drawing

src/docx/oxml/text/run.py:47–54  ·  view source on GitHub ↗

Return newly appended `CT_Drawing` (`w:drawing`) child element. The `w:drawing` element has `inline_or_anchor` as its child.

(self, inline_or_anchor: CT_Inline | CT_Anchor)

Source from the content-addressed store, hash-verified

45 return t
46
47 def add_drawing(self, inline_or_anchor: CT_Inline | CT_Anchor) -> CT_Drawing:
48 """Return newly appended `CT_Drawing` (`w:drawing`) child element.
49
50 The `w:drawing` element has `inline_or_anchor` as its child.
51 """
52 drawing = self._add_drawing()
53 drawing.append(inline_or_anchor)
54 return drawing
55
56 def clear_content(self) -> None:
57 """Remove all child elements except a `w:rPr` element if present."""

Callers 1

add_pictureMethod · 0.80

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected