猫史档案馆


【Python作品分享】转换图片

用户:兰镜嘉策(兰局兰段HXD3D-0177)兰镜嘉策(兰局兰段HXD3D-0177)查看:0 回复:0 评论:0 创建时间:2022-08-16T19:00:14


【作品展示】

center_image

 

【作品介绍】

玩出了个新三样

 

【作品源代码】

import pygame

pygame.init()

bin = pygame.image.load('bin.jpeg')
k = pygame.image.load('k.jpeg')
b738 = pygame.image.load('b738.webp')
a = 0
picture = [bin, k, b738]
picture_num = [(喵0, 喵0), (780, 426), (299, 168)]
screen = pygame.display.set_mode((picture_num[a]))

while True:
    screen.blit(picture[a], (0, 0))
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            exit()
        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_f:
                a += 1
                if a > 2:
                    a = 0
                screen = pygame.display.set_mode((picture_num[a]))
                screen.blit(picture[a], (0, 0))
                

            pygame.display.update()

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页