相关疑难解决方法(0)

从终端检测python中键盘输入的最简单方法是什么?

I have a simple python script, that has some functions that run in a loop (I'm taking sensor readings).

while True:
    print "Doing a function"
Run Code Online (Sandbox Code Playgroud)

If the keyboard is pressed I'd like to print "key pressed".

What's the simplest way of doing this in Python? I've searched high and low. I've found out how to do it with pygame, but I'd rather do it without. If I do have to use pygame is it possible to not have a separate …

python keyboard terminal

49
推荐指数
7
解决办法
12万
查看次数

标签 统计

keyboard ×1

python ×1

terminal ×1