exit()
# =================鼠标事件=================
elif event.type == pygame.MOUSEBUTTONDOWN:
# 鼠标按下后要做什么事情就写在这儿...
print('鼠标按下:', event.pos)
pygame.draw.circle(screen, rand_color(), event.pos, random.randint(10, 40))
pygame.display.flip()
elif event.type == pygame.MOUSEBUTTONUP:
# 鼠标按下后弹起
print('鼠标弹起', event.pos)
elif event.type == pygame.MOUSEMOTION:
# 鼠标移动
print('鼠标移动', event.pos)
# pygame.draw.circle(screen, rand_color(), event.pos, 30)
# pygame.display.flip()
# ==================键盘事件======================
elif event.type == pygame.KEYDOWN:
print('按键按下:', event.key, chr(event.key))
elif event.type == pygame.KEYUP:
print('按键弹起:', event.key, chr(event.key))
网友评论