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


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

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

Started byDave Angel <davea@davea.name>
First post2015-03-14 09:11 -0400
Last post2015-03-14 11:00 -0700
Articles 2 — 2 participants

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? Dave Angel <davea@davea.name> - 2015-03-14 09:11 -0400
    Re: Module/lib for controlling a terminal program using redrawing? Paul Rubin <no.email@nospam.invalid> - 2015-03-14 11:00 -0700

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

FromDave Angel <davea@davea.name>
Date2015-03-14 09:11 -0400
SubjectRe: Module/lib for controlling a terminal program using redrawing?
Message-ID<mailman.354.1426338694.21433.python-list@python.org>
On 03/14/2015 06: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?

https://docs.python.org/3/howto/curses.html

That's in the standard library for both Python2 and 3.  I don't know if 
it'll do everything you need, but if not, there are also various 
wrappers for curses that can be found with a google search.


-- 
DaveA

[toc] | [next] | [standalone]


#87436

FromPaul Rubin <no.email@nospam.invalid>
Date2015-03-14 11:00 -0700
Message-ID<87h9tncvcq.fsf@jester.gateway.sonic.net>
In reply to#87419
Dave Angel <davea@davea.name> writes:
>> Is there a module/library that can help me with this?
> https://docs.python.org/3/howto/curses.html

That's the opposite of what the OP wanted.  Curses generates the escape
codes and so on to draw your desired stuff on the terminal.  The OP
wants a screen scraper, something that takes the escape codes generated
by another program and interprets them to figure out what the screen is
supposed to look like.

The classic program that does this is Rog-o-matic.  I don't happen to
know of any Python code that does it but the search terms "python ansi
screen scraping" find some results that might be worth looking into.  It
also shouldn't be all that terribly hard to implement.

Leaving out the "ansi" keyword finds mostly HTML scrapers which aren't
what is wanted.  Trying other terminal types like "vt100" might find
desirable stuff though.

[toc] | [prev] | [standalone]


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


csiph-web