Python Forum

Full Version: looking 4 py code: output file in a text box
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i am wanting a command to output one (small) file in a text box, much like those relational db tools often do.

edit 1:
it would be a plus to put the file name somewhere reasonable in the output.
See Linux 'fmt' and 'fold' commands
i mean something like:
Output:
+--------------+ | this is text | | in a little  | | box          | +--------------+
and i am wanting to do it in python.

this one should be a module function and command in one file.
i still want it in py.
There is curses for python. It will be in .py file
if you're using linux, you might also try Urwid or npyscreen
i went ahead an wrote my own version of it.

it is not thoroughly tested but seems to work ok.

Output:
lt1/forums /home/forums 48> python box.py box.txt wide.txt | python box.py +---<STDIN>-----------------+ | +--------------+          | | | this is text |          | | | in a little  |          | | | box          |          | | +--------------+          | | +---<wide.txt>----------+ | | | this is text          | | | | in a definitely wider | | | | box                   | | | +-----------------------+ | +---------------------------+ lt1/forums /home/forums 49>
the code is over here.