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

Class _ColumnCollection

src/pptx/table.py:451–472  ·  view source on GitHub ↗

Sequence of table columns.

Source from the content-addressed store, hash-verified

449
450
451class _ColumnCollection(Subshape):
452 """Sequence of table columns."""
453
454 def __init__(self, tbl: CT_Table, parent: Table):
455 super(_ColumnCollection, self).__init__(parent)
456 self._parent = parent
457 self._tbl = tbl
458
459 def __getitem__(self, idx: int):
460 """Provides indexed access, (e.g. 'columns[0]')."""
461 if idx < 0 or idx >= len(self._tbl.tblGrid.gridCol_lst):
462 msg = "column index [%d] out of range" % idx
463 raise IndexError(msg)
464 return _Column(self._tbl.tblGrid.gridCol_lst[idx], self)
465
466 def __len__(self):
467 """Supports len() function (e.g. 'len(columns) == 1')."""
468 return len(self._tbl.tblGrid.gridCol_lst)
469
470 def notify_width_changed(self):
471 """Called by a column when its width changes. Pass along to parent."""
472 self._parent.notify_width_changed()
473
474
475class _RowCollection(Subshape):

Callers 5

getitem_fixtureMethod · 0.90
iter_fixtureMethod · 0.90
len_fixtureMethod · 0.90
columnsMethod · 0.85

Calls

no outgoing calls

Tested by 4

getitem_fixtureMethod · 0.72
iter_fixtureMethod · 0.72
len_fixtureMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…