examples/justify2.py
raw| 1 | """ |
| 2 | This example demonstrates the justify argument to print. |
| 3 | """ |
| 4 | |
| 5 | from rich.console import Console |
| 6 | from rich.panel import Panel |
| 7 | |
| 8 | console = Console(width=20) |
| 9 | |
| 10 | style = "bold white on blue" |
| 11 | panel = Panel("Rich", style="on red", expand=False) |
| 12 | console.print(panel, style=style) |
| 13 | console.print(panel, style=style, justify="left") |
| 14 | console.print(panel, style=style, justify="center") |
| 15 | console.print(panel, style=style, justify="right") |