我在pygame中测试了一些东西。为什么这会不断更新光标的位置
while 1:
pos = pygame.mouse.get_pos()
screen.fill(black)
screen.blit(ball,pos)
pygame.display.flip()
print pos
if pygame.event.get(27):
a = "exit"
虽然这不是吗?
while 1:
pos = pygame.mouse.get_pos()
screen.fill(black)
screen.blit(ball,pos)
pygame.display.flip()
print pos
if pygame.event.get():
a = "exit"
答案 0 :(得分:2)
这与您编写pygame.event.get()
while 1:
for event in pygame.event.get():
if event.type == pygame.QUIT:
a = "exit"
pos = pygame.mouse.get_pos()
screen.fill(black)
screen.blit(ball,pos)
pygame.display.flip()
print(pos)
#here you should also include a pygame.time.Clock().tick(60) to set the FPS