Does one have to use curses to read single characters from keyboard?

Alan Gauld learn2program at gmail.com
Tue Dec 13 03:46:48 EST 2022


On 12/12/2022 17:45, Alan Gauld wrote:

Absolutely nothing apparently!

But in practce I did pen some esponses to Davids post. However
this list seems to strip out what I've written, its happened
a few times now. Not every time but enough that I rarely post
here.

But I'll try once more...

> On 11/12/2022 21:07, dn wrote:
>> 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()?

>> 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...

Thanks for the plug David, but...

While my book is, I think, the only one specifically for curses with
Python, it's hardly a definitive tome on the subject, rather a
beginner's tutorial. An expanded HowTo if you like..

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

There are several such modules, including a good one by Fred Lundh.
They are cross platform and probably the best solution for the
OP if he doesn't mind using a third party module. I think Fred's
was called terminal? But its been a while I normally just use curses
for anything terminal related.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Python-list mailing list