我有一个NCurses的问题…我需要处理所有的键,如Esc,Alt F等
问题是代码是相似的,即:
问题是代码是相似的,即:
Esc – 27
Alt A – 27 65
举个例子,Alt [key]组合有两个代码,类似于Esc键…
任何想法如何处理?
解决方法
这是
python的一个例子:
key = self.screen.getch() if key == ord('q'): # quit go = False elif key == 27: # Esc or Alt # Don't wait for another key # If it was Alt then curses has already sent the other key # otherwise -1 is sent (Escape) self.screen.nodelay(True) n = self.screen.getch() if n == -1: # Escape was pressed go = False # Return to delay self.screen.nodelay(False)
原文地址:https://www.jb51.cc/html/229969.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。