#!/usr/bin/env python3 from asciiWriter.text import make_column, make_multi_column from asciiWriter.utils import merge, print_lines, make_lines, translate import math from os.path import join, dirname # Define width and height of the output width = 100 height = 250 # it would be nice to make an "automated fit" function, that defines the height based on an attempt to fill both columns. # Import a text text = open(join(dirname(__file__), 'data', 'language.txt')).read() # Import a hyphenator # Make an empty layers list layers = [] # Transform the text into a column try: from hyphen import Hyphenator h_en = Hyphenator('en_US') lines, remaining = make_column(text, height=height, use_hyphenator=h_en, line_width=80, line_offset=0) except ImportError: lines, remaining = make_column(text, height=height, line_width=80, line_offset=0) # Transform the text into multiple columns # lines, remaining = make_multi_column(text, height=height-3, use_hyphenator=h_en) lines = translate(lines, x=10, y=0) # Create an background background = make_lines(width, height, ' ') # Add all your layers to the layers list layers.append(background) layers.append(lines) # Merge the layers into one layer again merged = merge(width, height, ' ', layers) # Print the result print_lines(merged)