更新时间:2023-02-09 16:07:42
if event.type == pygame.MOUSEBUTTONDOWN:
print event.button
event.button可以等于多个整数值:
event.button can equal several integer values:
1-左键单击
2-中键
3-右键单击
4-向上滚动
5-向下滚动
代替事件,您还可以获取当前按钮状态:
Instead of an event, you can get the current button state as well:
pygame.mouse.get_pressed()
这将返回一个元组:
(左键单击,中键单击,右键单击)
(leftclick, middleclick, rightclick)
每个都是代表按钮上/下的布尔整数.
Each one is a boolean integer representing button up/down.