Create boxes in the terminal.
Python port of boxen
pip install textpanel
from textpanel import panel
print(panel("Hello World!",padding=1))
#╭──────────────╮
#│ │
#│ Hello World! │
#│ │
#╰──────────────╯
print(panel("Hello World!", padding=1, title='title'))
#╭───── title ──────╮
#│ │
#│ Hello World! │
#│ │
#╰──────────────────╯
panel(text, style?, padding?, margin?, width?, expand?, border_color?, text_alignment?, text_color?, border?, title?, title_alignment?)
Required
Type: string
Text inside the box
Type: string | dict
Default: single
Values:
'single'
┌───┐
│foo│
└───┘
'double'
╔═══╗
║foo║
╚═══╝
'round'
╭───╮
│foo│
╰───╯
'bold'
┏━━━┓
┃foo┃
┗━━━┛
'single-double'
╓───╖
║foo║
╙───╜
'double-single'
╒═══╕
│foo│
╘═══╛
'classic'
+---+
|foo|
+---+
'arrow'
↘↓↓↓↙
→foo←
↗↑↑↑↖
Box border style
Can be custom defined with a dict:
{
"topLeft": "┌",
"topRight": "┐",
"bottomRight": "┘",
"bottomLeft": "└",
"left": "│",
"right": "│",
"top": "─",
"bottom": "─"
}
Type: str
Display a title at the top of the box.
Type: str
Default: left
Values: left
center
right
Align the title in the top bar.
'left'
┌ title ────────┐
│foo bar foo bar│
└───────────────┘
'center'
┌──── title ────┐
│foo bar foo bar│
└───────────────┘
'right'
┌──────── title ┐
│foo bar foo bar│
└───────────────┘
Type: number
Default: 0
Space between the text and box border.
Type: number
Default: 0
Space around the box.
Type: number
Default: 0
Width of the box.
Type: bool
Default: False
Expand the box to the terminal width.
Type: str
Values: "black"
"red"
"green"
"orange"
"blue"
"purple"
"cyan"
"lightgrey"
"darkgrey"
"lightred"
"lightgreen"
"yellow"
"lightblue"
"pink"
"lightcyan"
Color of the box border.
Type: str
Default: left
Values: left
center
right
Alignment of the text inside the box.
Type: str
Values: "black"
"red"
"green"
"orange"
"blue"
"purple"
"cyan"
"lightgrey"
"darkgrey"
"lightred"
"lightgreen"
"yellow"
"lightblue"
"pink"
"lightcyan"
Color of the text inside the box.