[docs] [issue17700] Update Curses HOWTO for 3.4
report at bugs.python.org
Thu May 16 22:36:42 CEST 2013
STINNER Victor added the comment:
> Applied to 3.3 and 3.4. I'll leave this issue open
> for a week so that Victor can comment on Unicode/wide-characters.
I don't know (n)curses, but I tried to improve the curses module of Python. I added an encoding attribute which is the locale encoding by default, so it should work without special configuration. But it's good to know what the default encoding is. (It was UTF-8 on older Python 3 release, maybe in Python < 3.3.)
I also added functions like unget_wch() and get_wch().
The problem is that unget_wch() and get_wch() are not always available, it depends on the platform. If I remember correctly, it depends if libreadline is linked to libncursesw (and not libncurses).
Ah yes, and the Python curses modules uses Unicode versions of C curses functions if available. It is still possible to use thes bytes versions if you pass bytes strings. For example:
* window.addstr("abc"): use *add_wstr() functions if available, *addstr() otherwise
* window.addstr(b"abc"): always use *addstr() functions
I don't know enough the C libncursesw library to write an HOWTO or something like that.
I just would like to say that you should prefer get_wch() over getch() if get_wch() is available. But I don't understand exactly how curses behave with control characters ("keys"?) like "up" or "left".
Python tracker <report at bugs.python.org>
More information about the docs