Search code examples
pythonterminalcurses

How to skip a line using curses in Python?


I'm trying to find how to skip a line with curses. I've tried screen.addchr('\n') and screen.addstr("\n") but it didn't work. How can I do that ?


Solution

  • If you use screen.addch or screen.addstr in curses to pass a newline, it clears the remainder of the line. Instead, if you want to move down a line, you should get the current position using screen.getyx and use screen.move to move to the next line (by adding 1 to the y-value).

    Further reading: