PDA

View Full Version : [Py] Rewritable display buffer type thing?



linkmaster03
August 16th, 2008, 11:49 PM
I don't really know what to call it, but I'm wondering if there is a way in Python to create a sort of rewritable display buffer, where normally you'd have to reprint the whole thing on all these new lines according to the terminal height. Also it would flicker. If you still don't understand what I mean, something like an ASCII movie (blinkenlights starwars telnet kinda) or an ASCII RPG.

But yeah, is there any way to do this in Python? Maybe even resizing the terminal, and writing to it by line number and column.

days_of_ruin
August 17th, 2008, 03:01 AM
Are you using the ncurses module?

linkmaster03
August 17th, 2008, 03:44 AM
Uhh... I'm not using any module. I asked a question. Can ncurses do this?

linkmaster03
August 18th, 2008, 05:11 AM
Eh... if the ncurses module can do this, is there any good Python documentation for it?

jinksys
August 18th, 2008, 05:16 AM
Eh... if the ncurses module can do this, is there any good Python documentation for it?

:neutral:
First hit on google. GIYF.
http://www.amk.ca/python/howto/curses/

linkmaster03
August 18th, 2008, 08:29 AM
Thanks. I was barely even getting ncurses documentation, Google seems to show very different results for different people and their SafeSearch settings. -.-

jinksys
August 18th, 2008, 08:31 AM
Thanks. I was barely even getting ncurses documentation, Google seems to show very different results for different people and their SafeSearch settings. -.-

I searched for python ncurses.

nvteighen
August 18th, 2008, 10:13 AM
ncurses seems to be what you want. Install it using:



sudo apt-get install libncurses5-dev


The "problem" is that ncurses has some weird way to do things. It relies a lot in "switch" functions that change the screen's attributes, instead of directly accessing those attributes. Personally, I don't like how it works, but I don't know of any alternative either.