[Tutor] Arrow keys in subwindows

paulf at quillandmouse.com paulf at quillandmouse.com
Thu Jan 12 21:37:21 EST 2023


On Thu, 12 Jan 2023 22:53:44 +0000
Alan Gauld <learn2program at gmail.com> wrote:

> 
> 
> On 12/01/2023 16:17, paulf at quillandmouse.com wrote:
> 
> > I called stdscr.keypad(True), and then, within a class method,
> > called mwin = stdscr.subwin(...), and then mwin.keypad(True). 
> 
> That should work.
> 
> > with it, and somehow it now worked. So, problem solved for now.
> 
> Glad to hear it, althugh its always nice to know why! :-)

Actually, I think I found it. In one case, I was using getkey(), and in
another, getch(). In some cases, like fetching single letters, getkey()
worked fine. But for arrow keys and others, not. OTOH, getch() worked
fine in all cases, as long as you put the result through ord(), or
checked for KEY_LEFT, etc.. I had no idea I had used different methods
in different places.

Probably would have been good if I'd included the code in my email. ;-)

Paul

-- 
Paul M. Foster
Personal Blog: http://noferblatz.com
Company Site: http://quillandmouse.com
Software Projects: https://gitlab.com/paulmfoster


More information about the Tutor mailing list