Curses and Ncurses or whatevs.

So I was wondering how to make slightly less wonky command line programs. Sometimes they aren’t. Like top or nano or vi and stuff.

I think the answer is curses,

I basically read this

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

Here’s a short example program that I think sort of demonstrates enough to get you going.

Press q to quit

z, r, and p do stuff.

Very curious that you have to do this sequence of build up and tear down or else it freaks. Ctrl-c does exits nicely due to that bit of code about signals. Ctrl-c send SIGINT signal

 

Leave a Reply

Your email address will not be published. Required fields are marked *