Provides properties for manipulating a chart title.
| 200 | |
| 201 | |
| 202 | class ChartTitle(ElementProxy): |
| 203 | """Provides properties for manipulating a chart title.""" |
| 204 | |
| 205 | # This shares functionality with AxisTitle, which could be factored out |
| 206 | # into a base class, perhaps pptx.chart.shared.BaseTitle. I suspect they |
| 207 | # actually differ in certain fuller behaviors, but at present they're |
| 208 | # essentially identical. |
| 209 | |
| 210 | def __init__(self, title): |
| 211 | super(ChartTitle, self).__init__(title) |
| 212 | self._title = title |
| 213 | |
| 214 | @lazyproperty |
| 215 | def format(self): |
| 216 | """|ChartFormat| object providing access to line and fill formatting. |
| 217 | |
| 218 | Return the |ChartFormat| object providing shape formatting properties |
| 219 | for this chart title, such as its line color and fill. |
| 220 | """ |
| 221 | return ChartFormat(self._title) |
| 222 | |
| 223 | @property |
| 224 | def has_text_frame(self): |
| 225 | """Read/write Boolean specifying whether this title has a text frame. |
| 226 | |
| 227 | Return |True| if this chart title has a text frame, and |False| |
| 228 | otherwise. Assigning |True| causes a text frame to be added if not |
| 229 | already present. Assigning |False| causes any existing text frame to |
| 230 | be removed along with its text and formatting. |
| 231 | """ |
| 232 | if self._title.tx_rich is None: |
| 233 | return False |
| 234 | return True |
| 235 | |
| 236 | @has_text_frame.setter |
| 237 | def has_text_frame(self, value): |
| 238 | if bool(value) is False: |
| 239 | self._title._remove_tx() |
| 240 | return |
| 241 | self._title.get_or_add_tx_rich() |
| 242 | |
| 243 | @property |
| 244 | def text_frame(self): |
| 245 | """|TextFrame| instance for this chart title. |
| 246 | |
| 247 | Return a |TextFrame| instance allowing read/write access to the text |
| 248 | of this chart title and its text formatting properties. Accessing this |
| 249 | property is destructive in the sense it adds a text frame if one is |
| 250 | not present. Use :attr:`has_text_frame` to test for the presence of |
| 251 | a text frame non-destructively. |
| 252 | """ |
| 253 | rich = self._title.get_or_add_tx_rich() |
| 254 | return TextFrame(rich, self) |
| 255 | |
| 256 | |
| 257 | class _Plots(Sequence): |
no outgoing calls
searching dependent graphs…