A small package for printing boxes
Project description
Boxprint
A small package to print boxes
Usage
from boxprint import bprint
bprint("hello world")
╭──────────────────────────────────────────────────────────────────────────────╮
│ Hello World │
╰──────────────────────────────────────────────────────────────────────────────╯
Examples
Simple Usage
from boxprint import bprint, BoxTypes
"""
@param width
Max width of the box
@param box_type
The type of the box (LIGHT, HEAVY, DOUBLE, ROUND)
@param print_func
The print function to use
"""
bprint("hello_world", width=40, box_type=BoxTypes.HEAVY, print_func=print)
bprint("Text\nWith\nMultiple\nLines")
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Hello World ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
╭──────────────────────────────────────────────────────────────────────────────╮
│ Text │
│ With │
│ Multiple │
│ Lines │
╰──────────────────────────────────────────────────────────────────────────────╯
Nested Boxes
buf = []
def print_to_buf(string):
buf.append(string)
# Boxes apply 2 spaces of padding to the left and right width = (default=80 - 2*2)
bprint("Inner Box", width=76, print_func=print_to_buf)
inner_box = "".join(buf)
bprint(f"I am some text!\n{inner_box}", title="Outer Box")
╭─┤ Outer Box ├────────────────────────────────────────────────────────────────╮
│ │
│ I am some text! │
│ ╭──────────────────────────────────────────────────────────────────────────╮ │
│ │ Inner Box │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
Solid Box
from colors import * # ansicolors
bprint(
"\nhello_world\n",
width=40,
box_type=BoxTypes.FILL,
stroke_func=lambda text: color(text, fg="blue"),
fill_func=lambda text: color(text, bg="blue", fg="black")
)
▗▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▖
▐ ▌
▐ hello_world ▌
▐ ▌
▝▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▘
Debug
from boxprint.dprint import dprint
a_list_of_numbers = [1, 2, 3, 4, 5]
dprint(a_list_of_numbers)
a_list_of_numbers = None
dprint(a_list_of_numbers)
╭─┤ a_list_of_numbers ├────────────────────────────────────────────────────────╮
│ │
│ tests/test_debug.py:11 │
│ │
│ type = <class 'list'> │
│ value = [1, 2, 3, 4, 5] │
│ │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─┤ a_list_of_numbers ├────────────────────────────────────────────────────────╮
│ │
│ tests/test_debug.py:14 │
│ │
│ type = <class 'NoneType'> │
│ value = None │
│ │
╰──────────────────────────────────────────────────────────────────────────────╯
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
boxprint-0.0.9.tar.gz
(3.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file boxprint-0.0.9.tar.gz.
File metadata
- Download URL: boxprint-0.0.9.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
794242dcfcb9be4a314ca18613a22a4ff2a7dee065f5585490bebfc43fd0a627
|
|
| MD5 |
00e0f787c1fce128d32c532677e55e8c
|
|
| BLAKE2b-256 |
ef9ac278c118b8306883065d2d5494dd666e7948ce5dfa95caa4b403cbcf4c96
|
File details
Details for the file boxprint-0.0.9-py3-none-any.whl.
File metadata
- Download URL: boxprint-0.0.9-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3eb9798e9bd169a20e610a3efe86a233f0bc8bcd7182cff2336b34bd1a5342d
|
|
| MD5 |
fe8512e24740d43d71cec2f8b8a8bafc
|
|
| BLAKE2b-256 |
a843124e3e57c9627376414bd174823fb39c4f70f6ffa6c148c5f10df950c18a
|