Using curses module for python I know that writing in the lower-right corner raise an error (something to do with the cursor having no "next place" to go to).
But I do not care; all I wanted is to write a character when possible otherwise no big deal. So I though of using try-except-pass construct
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import curses
def doStuff(stdscr):
Y , X = stdscr.getmaxyx() # get screen size
try:
stdscr.addch(Y-1,X-1,'X') # try to print in forbiden corner
except:
pass # do nothing when error is raised
stdscr.refresh()
stdscr.getch()
curses.wrapper(doStuff)
I thougth that it would just "pass" and ignore the "addch" instruction. But to my surprise the character is printed!
Could someone explain me the reason?
ps: I confirm that without the try-except construct I get :
_curses.error: addch() returned ERR