【发布时间】:2018-04-23 02:35:23
【问题描述】:
我正在尝试使用鼠标位置来实现游戏,以查看用户是否单击按钮。不知何故,鼠标位置不会更新几秒钟,然后再改变几秒钟,然后重复。我在屏幕的不同位置移动并按下鼠标,但鼠标位置根本没有改变。 (在 python3.5.1 和 pygame 1.9.2 上工作,使用 IDE PyCharm)知道吗? 这是我的代码:
done = False
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
mouse = pygame.mouse.get_pos()
click = pygame.mouse.get_pressed()
if click[0]==1:
print(mouse)
pygame.display.update()
【问题讨论】:
-
你是在 pygame 窗口内点击吗?
标签: python pygame mouseevent mouse-position