Python祝福的库缺少按键事件

问题描述

blessed Python库非常适合制作控制台应用程序,但是我在键盘功能方面遇到了麻烦。在下面的代码中,仅每秒检测一次按键。为什么要这样?

我在使用Python 3.8的Windows 10上。

from blessed import Terminal


term = Terminal()
print(f"{term.home}{term.black_on_skyblue}{term.clear}")

    
with term.cbreak(),term.hidden_cursor():
    while term.inkey() != 'q':
        inp = term.inkey()
        if inp.name == "KEY_LEFT":
            print("You pressed left")

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)