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

Class LineFormat

src/pptx/dml/line.py:10–100  ·  view source on GitHub ↗

Provides access to line properties such as color, style, and width. A LineFormat object is typically accessed via the ``.line`` property of a shape such as |Shape| or |Picture|.

Source from the content-addressed store, hash-verified

8
9
10class LineFormat(object):
11 """Provides access to line properties such as color, style, and width.
12
13 A LineFormat object is typically accessed via the ``.line`` property of
14 a shape such as |Shape| or |Picture|.
15 """
16
17 def __init__(self, parent):
18 super(LineFormat, self).__init__()
19 self._parent = parent
20
21 @lazyproperty
22 def color(self):
23 """
24 The |ColorFormat| instance that provides access to the color settings
25 for this line. Essentially a shortcut for ``line.fill.fore_color``.
26 As a side-effect, accessing this property causes the line fill type
27 to be set to ``MSO_FILL.SOLID``. If this sounds risky for your use
28 case, use ``line.fill.type`` to non-destructively discover the
29 existing fill type.
30 """
31 if self.fill.type != MSO_FILL.SOLID:
32 self.fill.solid()
33 return self.fill.fore_color
34
35 @property
36 def dash_style(self):
37 """Return value indicating line style.
38
39 Returns a member of :ref:`MsoLineDashStyle` indicating line style, or
40 |None| if no explicit value has been set. When no explicit value has
41 been set, the line dash style is inherited from the style hierarchy.
42
43 Assigning |None| removes any existing explicitly-defined dash style.
44 """
45 ln = self._ln
46 if ln is None:
47 return None
48 return ln.prstDash_val
49
50 @dash_style.setter
51 def dash_style(self, dash_style):
52 if dash_style is None:
53 ln = self._ln
54 if ln is None:
55 return
56 ln._remove_prstDash()
57 ln._remove_custDash()
58 return
59 ln = self._get_or_add_ln()
60 ln.prstDash_val = dash_style
61
62 @lazyproperty
63 def fill(self):
64 """
65 |FillFormat| instance for this line, providing access to fill
66 properties such as foreground color.
67 """

Callers 9

lineMethod · 0.90
lineMethod · 0.90
lineMethod · 0.90
lineMethod · 0.90
width_get_fixtureMethod · 0.90
width_set_fixtureMethod · 0.90
lineMethod · 0.90

Calls

no outgoing calls

Tested by 5

width_get_fixtureMethod · 0.72
width_set_fixtureMethod · 0.72
lineMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…