Print to the console. Args: objects (positional args): Objects to log to the terminal. sep (str, optional): String to write between print data. Defaults to " ". end (str, optional): String to write at end of print data. Defaults to "\\\\n". st
(
self,
*objects: Any,
sep: str = " ",
end: str = "\n",
style: Optional[Union[str, Style]] = None,
justify: Optional[JustifyMethod] = None,
overflow: Optional[OverflowMethod] = None,
no_wrap: Optional[bool] = None,
emoji: Optional[bool] = None,
markup: Optional[bool] = None,
highlight: Optional[bool] = None,
width: Optional[int] = None,
height: Optional[int] = None,
crop: bool = True,
soft_wrap: Optional[bool] = None,
new_line_start: bool = False,
)
| 1650 | ) |
| 1651 | |
| 1652 | def print( |
| 1653 | self, |
| 1654 | *objects: Any, |
| 1655 | sep: str = " ", |
| 1656 | end: str = "\n", |
| 1657 | style: Optional[Union[str, Style]] = None, |
| 1658 | justify: Optional[JustifyMethod] = None, |
| 1659 | overflow: Optional[OverflowMethod] = None, |
| 1660 | no_wrap: Optional[bool] = None, |
| 1661 | emoji: Optional[bool] = None, |
| 1662 | markup: Optional[bool] = None, |
| 1663 | highlight: Optional[bool] = None, |
| 1664 | width: Optional[int] = None, |
| 1665 | height: Optional[int] = None, |
| 1666 | crop: bool = True, |
| 1667 | soft_wrap: Optional[bool] = None, |
| 1668 | new_line_start: bool = False, |
| 1669 | ) -> None: |
| 1670 | """Print to the console. |
| 1671 | |
| 1672 | Args: |
| 1673 | objects (positional args): Objects to log to the terminal. |
| 1674 | sep (str, optional): String to write between print data. Defaults to " ". |
| 1675 | end (str, optional): String to write at end of print data. Defaults to "\\\\n". |
| 1676 | style (Union[str, Style], optional): A style to apply to output. Defaults to None. |
| 1677 | justify (str, optional): Justify method: "default", "left", "right", "center", or "full". Defaults to ``None``. |
| 1678 | overflow (str, optional): Overflow method: "ignore", "crop", "fold", or "ellipsis". Defaults to None. |
| 1679 | no_wrap (Optional[bool], optional): Disable word wrapping. Defaults to None. |
| 1680 | emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default. Defaults to ``None``. |
| 1681 | markup (Optional[bool], optional): Enable markup, or ``None`` to use console default. Defaults to ``None``. |
| 1682 | highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default. Defaults to ``None``. |
| 1683 | width (Optional[int], optional): Width of output, or ``None`` to auto-detect. Defaults to ``None``. |
| 1684 | crop (Optional[bool], optional): Crop output to width of terminal. Defaults to True. |
| 1685 | soft_wrap (bool, optional): Enable soft wrap mode which disables word wrapping and cropping of text or ``None`` for |
| 1686 | Console default. Defaults to ``None``. |
| 1687 | new_line_start (bool, False): Insert a new line at the start if the output contains more than one line. Defaults to ``False``. |
| 1688 | """ |
| 1689 | if not objects: |
| 1690 | if end == "\n": |
| 1691 | objects = (NewLine(),) |
| 1692 | else: |
| 1693 | objects = ("",) |
| 1694 | |
| 1695 | if soft_wrap is None: |
| 1696 | soft_wrap = self.soft_wrap |
| 1697 | if soft_wrap: |
| 1698 | if no_wrap is None: |
| 1699 | no_wrap = True |
| 1700 | if overflow is None: |
| 1701 | overflow = "ignore" |
| 1702 | crop = False |
| 1703 | render_hooks = self._render_hooks[:] |
| 1704 | with self: |
| 1705 | renderables = self._collect_renderables( |
| 1706 | objects, |
| 1707 | sep, |
| 1708 | end, |
| 1709 | justify=justify, |