我有这个简单的程序。程序中也没有错误,当我按 q 程序退出时
import curses
def main(stdscr):
while 1:
Key = stdscr.getch()
if Key == curses.KEY_UP:
stdscr.addstr(0,0,'u pressed up key ')
stdscr.refresh()
elif Key == curses.KEY_DOWN:
stdscr.addstr(0,0,'u pressed down key')
stdscr.refresh()
elif Key == curses.KEY_LEFT:
stdscr.addstr(0,0,'u pressed left key')
stdscr.refresh()
elif Key == curses.KEY_RIGHT:
stdscr.addstr(0,0,'u pressed right key')
stdscr.refresh()
elif Key == ord('q'):
break
curses.wrapper(main)