Oct-26-2019, 03:34 PM
I am a beginning python programmer and I also teach introductory python.
I (we) are looking for a keyboard scan routine to capture keyboard input without entering a return.
We use Linux as out main os.
I personally have used curses but I'm looking for a simple pythonic method to teach this skill.
QUESTIONS:
Is curses used a lot?
Can curses be used with MS Windows?
What are some simple alternatives?
Thank you,
1885
example I've used :
import curses
import os
I (we) are looking for a keyboard scan routine to capture keyboard input without entering a return.
We use Linux as out main os.
I personally have used curses but I'm looking for a simple pythonic method to teach this skill.
QUESTIONS:
Is curses used a lot?
Can curses be used with MS Windows?
What are some simple alternatives?
Thank you,
1885
example I've used :
import curses
import os
def main(win): win.nodelay(True) key="" win.clear() win.addstr("Detected key:") while 1: try: key = win.getkey() win.clear() win.addstr("Detected key:") win.addstr(str(key)) if key == os.linesep: break except Exception as e: # No input pass curses.wrapper(main)