猫史档案馆


【Python作品分享】某游戏【作品秀】

用户:金钿森金钿森查看:0 回复:2 评论:0 创建时间:2020-08-03T21:06:08


【作品展示】

center_image

 

【作品介绍】

敲一敲鼠标

 

【作品源代码】

import pygame
import sys

LEFT = 1
a=0
running = True
screen = pygame.display.set_mode((1200, 1000))


while running:
    screen.fill((0, 0, 0))
    pygame.display.flip()
    event = pygame.event.poll()
    if event.type == pygame.QUIT:
        running = False
        pygame.quit()

    elif event.type == pygame.MOUSEBUTTONDOWN and event.button == LEFT:
        print("You pressed the left mouse button at (%d, %d)" % event.pos)
        a+=1
    elif event.type == pygame.MOUSEBUTTONUP and event.button == LEFT:
        print("You released the left mouse button at (%d, %d)" % event.pos)
print(a)

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
金钿森金钿森

效果图是我随便找的,不喜勿喷

 

点赞0


评论


程序侯程序侯

好家伙,竟然还有人玩pygame用控制台

点赞0


评论