day17

作者: Smr_T | 来源:发表于2018-10-23 19:35 被阅读0次

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))

相关文章

网友评论

      本文标题:day17

      本文链接:https://www.haomeiwen.com/subject/szzazftx.html