Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #87441

Re: Module/lib for controlling a terminal program using redrawing?

Path csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'url:pypi': 0.03; 'automate': 0.07; '"if': 0.09; "'python": 0.09; 'cursor': 0.09; 'emulate': 0.09; 'in-house': 0.09; 'interpreted': 0.09; 'pointers': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'screen.': 0.09; 'subject:using': 0.09; 'python': 0.11; 'jan': 0.12; 'sections': 0.14; 'aptitude': 0.16; 'carriage': 0.16; 'emacs,': 0.16; 'emulation': 0.16; 'emulator': 0.16; 'line).': 0.16; 'overwriting': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:program': 0.16; 'index': 0.16; 'wrote:': 0.18; 'library': 0.18; 'module': 0.19; 'trying': 0.19; 'seems': 0.21; 'memory': 0.22; 'this?': 0.23; 'header:User-Agent:1': 0.23; 'oriented': 0.24; 'login': 0.25; 'subject:/': 0.26; 'header:X-Complaints- To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'appreciated.': 0.29; 'external': 0.29; 'am,': 0.29; 'unix': 0.29; 'dec': 0.30; 'program,': 0.31; 'that.': 0.31; 'towards': 0.31; 'fine,': 0.31; 'stands': 0.31; 'class': 0.32; 'run': 0.32; 'linux': 0.33; 'url:python': 0.33; 'screen': 0.34; 'but': 0.35; 'there': 0.35; 'ubuntu': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'searching': 0.37; 'application': 0.37; 'displays': 0.38; 'jason': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'removing': 0.60; 'new': 0.61; 'complete': 0.62; 'making': 0.63; 'developed': 0.63; 'kind': 0.63; 'more': 0.64; 'movement': 0.65; 'series': 0.66; 'between': 0.67; 'prompt': 0.68; '(probably': 0.84; 'guts': 0.84; 'received:fios.verizon.net': 0.84; 'old,': 0.85
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: Module/lib for controlling a terminal program using redrawing?
Date Sat, 14 Mar 2015 14:50:47 -0400
References <CA+Zd3FeBRz2ErLZLX1rsFioUrtLmrpC5TnLqCp=QpmBiiGOhcQ@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host pool-98-114-97-173.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0
In-Reply-To <CA+Zd3FeBRz2ErLZLX1rsFioUrtLmrpC5TnLqCp=QpmBiiGOhcQ@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.19
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.369.1426359080.21433.python-list@python.org> (permalink)
Lines 49
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1426359080 news.xs4all.nl 2904 [2001:888:2000:d::a6]:56819
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:87441

Show key headers only | View raw


On 3/14/2015 6:50 AM, Jason Heeris wrote:
> I am trying to automate the use of some old, in-house terminal-based
> programs that use screen redrawing for their interface. This includes
> single line redrawing (eg. using '\r' and overwriting), complete screen
> clearing, and fine-grained cursor movement and overwriting (probably not
> all in the same program at the same time though).
>
> Is there a module/library that can help me with this?
>
> I know of pexpect, but that seems more oriented towards line-by-line
> prompts that don't involve redraws (eg. login prompt, then password
> prompt on a new line). Think instead of trying to automate applications
> like emacs, aptitude or even nethack that redraw sections of the screen
> without making the terminal scroll.
>
> This automation requires more than just sending a set of keystrokes, but
> also reading what is displayed on screen and making decisions based up
> on that.
>
> Is there a library that can abstract the received redrawing activity so
> I don't have to even know if the application has, eg. used a carriage
> return or some other kind of cursor movement? Is there a way to just ask
> "if this were to be run in an ANSI terminal, what would be in each cell?"
>
> Python 2 or 3 are both fine, external packages are fine, but it has to
> work on Linux (eg. Ubuntu 14.04 or later, Debian Wheezy or later).
>
> Any pointers appreciated.

Perhaps you can use the guts of a terminal emulation program, removing 
the part that displays the interpreted stream (a 24 x 80 array) on the 
screen.  Searching 'python terminal emulation' returns these

terminal.py - A Pure Python Terminal Emulator - GitHub Pages
liftoff.github.io/GateOne/Developer/terminal.html
This crux of this module is the Terminal class which is a pure-Python 
implementation of the quintessential Unix terminal emulator. It does its 
best to emulate an ...

pyte 0.4.9 : Python Package Index
https://pypi.python.org/pypi/pyte/
Python
Dec 3, 2014 - What is pyte? It's an in memory VTXXX-compatible terminal 
emulator. XXX stands for a series of video terminals, developed by DEC 
between ...

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Module/lib for controlling a terminal program using redrawing? Terry Reedy <tjreedy@udel.edu> - 2015-03-14 14:50 -0400

csiph-web