铁蟒不产生击键

时间:2018-11-07 16:06:05

标签: python ironpython keystroke

到目前为止,这是我的代码。我不确定为什么当我尝试按一个键并打印出一个字符串时,getch和ord在Iron Python中不能正常工作。

from msvcrt import getch

while True:  
    key = ord(getch())  #sets variable to a random key looked up by ord  
    if key == 27:       #if esc key pressed, it quits  
        break  
    elif key == 9:      # if tab key is pressed prints  
        print('take picture')  
    else:           # if nothing is pressed it continues    
        pass    

当我在Python 3.7中运行它时,它可以正常运行,但是当我将其放入Iron Python中时,它在处理它时会遇到问题,并且会打印出65535或ascii错误(仅当我删除ord函数时)

0 个答案:

没有答案