Curses in Python

I’ve started learning curses, in part because I needed to learn something new in Python, and I’m GUI-phobic, and in part because I have a secret love affair with terminals :)

So I’m going through this tutorial (written in part by Eric S. Raymond, no less), and when I get done with that I’ll look at the actual Python documentation. I don’t know why, but the ESR tutorial has an error: It says that to restore the terminal to normal, you need one of these at the end:

curses.nocbreak()
stdscr.keypad(0)
curses.echo()

However…that doesn’t work. So I learned on the Ubuntu Forums that the real way of restoring the terminal is:

stdscr.getch()
curses.endwin()

I’ll post if anything exciting happens, either from a functional or educational point of view…

Share/Save/Bookmark

4 Comments »

  1. ragginfrgainnblargy Said,

    March 9, 2009 @ 6:20 AM

    >Hello there follow Reddit user! If you like this article, please remember to vote for this article on Reddit.

    ^ typo there.

  2. Timmy Said,

    March 9, 2009 @ 1:21 PM

    *shame*
    Thanks
    On that–does anybody have a strong opinion one way or the other about the greet box? Because I’m obviously all for getting Reddit/etc. votes, but if it’s annoying for readers I’ll take it out.

  3. Jebadiah Moore Said,

    March 10, 2009 @ 2:01 AM

    I’m not a fan of greet boxes–they seem a little too marketing-ish.

  4. Timmy Said,

    March 10, 2009 @ 1:10 PM

    Yeah, I was wondering if somebody wouldn’t say that…
    It’s now gone.

Leave a Comment