On 11/12/2022 23.09, Chris Green wrote:
Is the only way to read single characters from the keyboard to use
curses.cbreak() or curses.raw()?  If so how do I then read characters,
it's not at all obvious from the curses documentation as that seems to
think I'm using a GUI in some shape or form.

All I actually want to do is get 'Y' or 'N' answers to questions on
the command line.

Searching for ways to do this produces what seem to me rather clumsy
ways of doing it.

You may like to re-ask this question over on the Python-Tutor list. The ListAdmin over there (literally) wrote the book on Python+curses...


Did such research include the keyboard module?
https://pypi.org/project/keyboard/

This project includes an (Enter-free) "hot-key" feature which firstly detects the specific key or key-combination, and then calls an action if/when True.
(amongst other functionality)

Quick read tutorial: https://www.thepythoncode.com/article/control-keyboard-python

Disclaimer: have had it on my 'radar', but never actually employed.
(if you have considered, will be interested to hear conclusions...)
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to