gpt4 book ai didi

key - NCurses 和 ESC、ALT 键

转载 作者:行者123 更新时间:2023-12-03 00:13:27 26 4
gpt4 key购买 nike

我的NCurses有问题...我需要处理所有按键,例如EscAlt+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)

关于key - NCurses 和 ESC、ALT 键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5977395/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com