terminal - How do I create a static framed ASCII interface in Python? -
when use less command in mac terminal i'm shown 23 row slice of specified file. if move down file, scroll in terminal window, don't see file content before current slice. instead, see commands typed before using less.
i use or similar effect create ascii game interface shows current screen, no history. draw frames on screen , change text or options within frames. common in older systems ran or entirely in command line environment.
is there python module offers this? effect can or should implement myself?
here example screen elements benefit effect.
+-------------------------------------------------------------------+ | | | dialog dialog dialog dialog dialog dialog dialog dialog dialog | | dialog dialog dialog dialog dialog dialog dialog dialog dialog | | dialog dialog dialog dialog dialog dialog dialog dialog dialog | | dialog dialog dialog dialog dialog dialog dialog dialog dialog | | dialog dialog dialog dialog. | | | | | | | +--------------------+---------------+------------------------------+ | attack | south | hp/max mp/max | | > cast magic | - | tom: 120/120 60/91 | | use item | new | > dick: 27/133 47/47 | | tactics | schwartzton | harry: 87/104 16/113 | +--------------------+---------------+------------------------------+
i suggest looking curses module. it's interface ncurses library, used purpose (i believe many terminal applications written in it). documentation quite decent, , there several nice tutorials should set in right direction.
(either or liberal use of \r.) suggest curses module, since should provide more flexibility you're looking do.
edit: if you're interested in creating cross-platform application, keep in mind curses module available on *nix systems. per documentation:
no 1 has made windows port of curses module.
that tutorial recommends this library use on windows, although if dates on download page indication, has not been updated in fair amount of time. this module, looks considerably more recent.
Comments
Post a Comment