我试着用pygame捕捉Enter按钮,而不是键盘上的Enter按钮,我想要的是Backspace按钮下的Enter按钮。它们不一样,因为当我按下键盘上的回车键时,其他的回车键就不工作了。
有关于按键的文档,但只有键盘输入按钮。我试过这些密码:
This working for keypad Enter button, but other Enter button is not working:
if event.type==pygame.KEYDOWN:
if event.key==pygame.K_KP_ENTER:
#some codes
I tried to catch another Enter button with these codes(hopeless):
if event.type==pygame.KEYDOWN:
if event.key==pygame.K_ENTER:
#some codes
但当然出现了一个错误:
AttributeError: 'module' object has no attribute 'K_ENTER'
无法理解如何在Backspace下捕获Enter按钮。
我想您需要K_RETURN,因为backspace下的enter键有时被称为“回车键”,来自老式打字机的行话。
相关问题 更多 >
编程相关推荐