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

2019-02-28 Thread Malcolm Herbert
yes - usually that was the prompt for the terminal to insert a new line ... on 
some terminals this is a behaviour you can't control as it's implemented in 
hardware, so curses fakes things by moving the cursor back to where it "should" 
be afterward.

If you try and to something when the cursor is at the extreme bottom right of 
the window/region and the terminal is hard-coded to do $magic immediately 
after, then your screen will be all messed up.

-- 
Malcolm Herbert
m...@mjch.net
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


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

2019-02-27 Thread boB Stepp
On Wed, Feb 27, 2019 at 8:09 PM Alex Kleider  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:
> >
> > 
> > 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
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


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

2019-02-27 Thread Alex Kleider

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:


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?

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


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

2019-02-27 Thread boB Stepp
Under https://docs.python.org/3/library/curses.html#window-objects in
the curses docs, it states:


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.


Why is this?  What is special about the lower right corner of a
terminal window?  I am guessing this is some relic of the original
terminal era.

TIA!

-- 
boB
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor