a python library to draw with ASCII (but with Unicode)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

37 lines
931 B

#!/usr/bin/env python3
from asciiWriter.text import make_column
from asciiWriter.utils import merge, print_lines, make_lines
from hyphen import Hyphenator
# Define width and height of the output
width = 100
height = 50
# Import a text
text = open('texts/language.txt').read()
print(text)
# Import a hyphenator
h_en = Hyphenator('en_US')
# Make an empty layers list
layers = []
# Transform the text into a column
lines_column1, remaining = make_column(text, linewidth=30, height=height, use_hyphenator=h_en)
lines_column2, remaining = make_column(remaining, linewidth=30, height=height, use_hyphenator=h_en)
# Create an background
background = make_lines(width, height, '*')
# Add all your layers to the layers list
layers.append(background)
layers.append(lines_column1)
layers.append(lines_column2)
# Merge the layers into one layer again
merged = merge(width, height, ' ', layers)
# Print the result
print_lines(merged)