Skip to main content

textpanel

Create boxes in the terminal.

Python port of boxen

Install

pip install textpanel

Usage

from textpanel import panel

print(panel("Hello World!",padding=1))
#╭──────────────╮
#│              │
#│ Hello World! │
#│              │
#╰──────────────╯

print(panel("Hello World!", padding=1, title='title'))
#╭───── title ──────╮
#│                  │
#│   Hello World!   │
#│                  │
#╰──────────────────╯

API

panel(text, style?, padding?, margin?, width?, expand?, border_color?, text_alignment?, text_color?, border?, title?, title_alignment?)

text

Required
Type: string
Text inside the box

border_style

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": "─"
}

title

Type: str
Display a title at the top of the box.

title_alignment

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│
└───────────────┘

padding

Type: number
Default: 0
Space between the text and box border.

margin

Type: number
Default: 0
Space around the box.

width

Type: number
Default: 0
Width of the box.

expand

Type: bool
Default: False
Expand the box to the terminal width.

border_color

Type: str
Values: "black" "red" "green" "orange" "blue" "purple" "cyan" "lightgrey" "darkgrey" "lightred" "lightgreen" "yellow" "lightblue" "pink" "lightcyan"
Color of the box border.

text_alignment

Type: str
Default: left
Values: left center right
Alignment of the text inside the box.

text_color

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.

Release files for textpanel 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for textpanel 1.0.1
File Size Uploaded
textpanel-1.0.1.tar.gz 7.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for textpanel 1.0.1
File Interpreter ABI Platform
textpanel-1.0.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 13.4 kB

Release files / textpanel-1.0.1.tar.gz

Download URL textpanel-1.0.1.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
154f2134811c2ae145ca8e7e787bab5ed6650f86049fea92965f8b27d2ec0043
BLAKE2b-256 checksum
How to use checksums
2b48adbee2eea991e6017f7621dd9bd22ded40c7407ba2af19275dab3d24f961
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.0 keyring/23.5.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.7

Release files / textpanel-1.0.1-py2.py3-none-any.whl

Download URL textpanel-1.0.1-py2.py3-none-any.whl
Size 5.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
abcf40a0cd8dd883bc450208f95f143adc3890728506a2b044fc955bd6a79a4a
BLAKE2b-256 checksum
How to use checksums
1afcbb05473e6c2fcbd8391c8931c12a1f1c74e0719c4a9914425f0e5d418051
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.0 keyring/23.5.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.7

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page