[Tutor] Why does using "window.addchr()" to place a character at the lower right corner raise an exception?

boB Stepp robertvstepp at gmail.com
Wed Feb 27 21:15:44 EST 2019


On Wed, Feb 27, 2019 at 8:09 PM Alex Kleider <akleider at sonic.net> wrote:
>
> On 2019-02-27 17:48, boB Stepp wrote:
> > Under https://docs.python.org/3/library/curses.html#window-objects in
> > the curses docs, it states:
> >
> > <quote>
> > window.addch(ch[, attr])
> > window.addch(y, x, ch[, attr])
> > [...]
> >
> > Note
> >
> > Writing outside the window, subwindow, or pad raises a curses.error.
> > Attempting to write to the lower right corner of a window, subwindow,
> > or pad will cause an exception to be raised after the character is
> > printed.
>
> Could it be that as soon as the character is printed the cursor moves to
> the 'next location' which is outside of the 'window, subwindow, or pad'
> and it is this which causes the error to be raised?

Alex, I think you have nailed it!  Everything I have read so far
indicates that an exception will be thrown whenever attempting to
write outside of a window, subwindow or pad.  So it would appear to
follow that if for some reason I need to write something to that very
last cell I will have to handle the exception generated.

Thanks!


-- 
boB


More information about the Tutor mailing list