Add a column to the table. Args: header (RenderableType, optional): Text or renderable for the header. Defaults to "". footer (RenderableType, optional): Text or renderable for the footer. Defaults to "". header_style (Unio
(
self,
header: "RenderableType" = "",
footer: "RenderableType" = "",
*,
header_style: Optional[StyleType] = None,
highlight: Optional[bool] = None,
footer_style: Optional[StyleType] = None,
style: Optional[StyleType] = None,
justify: "JustifyMethod" = "left",
vertical: "VerticalAlignMethod" = "top",
overflow: "OverflowMethod" = "ellipsis",
width: Optional[int] = None,
min_width: Optional[int] = None,
max_width: Optional[int] = None,
ratio: Optional[int] = None,
no_wrap: bool = False,
)
| 362 | return self |
| 363 | |
| 364 | def add_column( |
| 365 | self, |
| 366 | header: class="st">"RenderableType" = class="st">"", |
| 367 | footer: class="st">"RenderableType" = class="st">"", |
| 368 | *, |
| 369 | header_style: Optional[StyleType] = None, |
| 370 | highlight: Optional[bool] = None, |
| 371 | footer_style: Optional[StyleType] = None, |
| 372 | style: Optional[StyleType] = None, |
| 373 | justify: class="st">"JustifyMethod" = class="st">"left", |
| 374 | vertical: class="st">"VerticalAlignMethod" = class="st">"top", |
| 375 | overflow: class="st">"OverflowMethod" = class="st">"ellipsis", |
| 376 | width: Optional[int] = None, |
| 377 | min_width: Optional[int] = None, |
| 378 | max_width: Optional[int] = None, |
| 379 | ratio: Optional[int] = None, |
| 380 | no_wrap: bool = False, |
| 381 | ) -> None: |
| 382 | class="st">"""Add a column to the table. |
| 383 | |
| 384 | Args: |
| 385 | header (RenderableType, optional): Text or renderable for the header. |
| 386 | Defaults to class="st">"". |
| 387 | footer (RenderableType, optional): Text or renderable for the footer. |
| 388 | Defaults to class="st">"". |
| 389 | header_style (Union[str, Style], optional): Style for the header, or None for default. Defaults to None. |
| 390 | highlight (bool, optional): Whether to highlight the text. The default of None uses the value of the table (self) object. |
| 391 | footer_style (Union[str, Style], optional): Style for the footer, or None for default. Defaults to None. |
| 392 | style (Union[str, Style], optional): Style for the column cells, or None for default. Defaults to None. |
| 393 | justify (JustifyMethod, optional): Alignment for cells. Defaults to class="st">"left". |
| 394 | vertical (VerticalAlignMethod, optional): Vertical alignment, one of class="st">"top", class="st">"middle", or class="st">"bottom". Defaults to class="st">"top". |
| 395 | overflow (OverflowMethod): Overflow method: class="st">"crop", class="st">"fold", class="st">"ellipsis". Defaults to class="st">"ellipsis". |
| 396 | width (int, optional): Desired width of column in characters, or None to fit to contents. Defaults to None. |
| 397 | min_width (Optional[int], optional): Minimum width of column, or ``None`` for no minimum. Defaults to None. |
| 398 | max_width (Optional[int], optional): Maximum width of column, or ``None`` for no maximum. Defaults to None. |
| 399 | ratio (int, optional): Flexible ratio for the column (requires ``Table.expand`` or ``Table.width``). Defaults to None. |
| 400 | no_wrap (bool, optional): Set to ``True`` to disable wrapping of this column. |
| 401 | class="st">""" |
| 402 | |
| 403 | column = Column( |
| 404 | _index=len(self.columns), |
| 405 | header=header, |
| 406 | footer=footer, |
| 407 | header_style=header_style or class="st">"", |
| 408 | highlight=highlight if highlight is not None else self.highlight, |
| 409 | footer_style=footer_style or class="st">"", |
| 410 | style=style or class="st">"", |
| 411 | justify=justify, |
| 412 | vertical=vertical, |
| 413 | overflow=overflow, |
| 414 | width=width, |
| 415 | min_width=min_width, |
| 416 | max_width=max_width, |
| 417 | ratio=ratio, |
| 418 | no_wrap=no_wrap, |
| 419 | ) |
| 420 | self.columns.append(column) |
| 421 |