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


Groups > comp.lang.python > #87441 > unrolled thread

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

Started byTerry Reedy <tjreedy@udel.edu>
First post2015-03-14 14:50 -0400
Last post2015-03-14 14:50 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

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

FromTerry Reedy <tjreedy@udel.edu>
Date2015-03-14 14:50 -0400
SubjectRe: Module/lib for controlling a terminal program using redrawing?
Message-ID<mailman.369.1426359080.21433.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web