> I'm looking for a kbhit/getch equivalent in python in order to be able to > stop my inner loop in a controlled way (communication with external hardware > is involved and breaking it abruptly may cause unwanted errors
A curses example import curses stdscr = curses.initscr() curses.cbreak() stdscr.keypad(1) stdscr.addstr(0,10,"Hit 'q' to quit ") stdscr.refresh() key = '' while key != ord('q'): key = stdscr.getch() stdscr.addch(20,25,key) stdscr.refresh() curses.endwin() -- http://mail.python.org/mailman/listinfo/python-list