Python Forum
looking 4 py code: output file in a text box - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Forum & Off Topic (https://python-forum.io/forum-23.html)
+--- Forum: Bar (https://python-forum.io/forum-27.html)
+--- Thread: looking 4 py code: output file in a text box (/thread-1404.html)



looking 4 py code: output file in a text box - Skaperen - Dec-31-2016

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.


RE: looking 4 py code: output file in a text box - wavic - Dec-31-2016

See Linux 'fmt' and 'fold' commands


RE: looking 4 py code: output file in a text box - Skaperen - Dec-31-2016

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.


RE: looking 4 py code: output file in a text box - wavic - Dec-31-2016

curses?


RE: looking 4 py code: output file in a text box - Skaperen - Dec-31-2016

i still want it in py.


RE: looking 4 py code: output file in a text box - wavic - Dec-31-2016

There is curses for python. It will be in .py file


RE: looking 4 py code: output file in a text box - sparkz_alot - Dec-31-2016

if you're using linux, you might also try Urwid or npyscreen


RE: looking 4 py code: output file in a text box - Skaperen - Jan-01-2017

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.