猫史档案馆


鬼畜的小朋友

用户:太阳黑子太阳黑子查看:0 回复:0 评论:0 创建时间:2020-09-05T20:25:08


import requests import pygame import random a=requests.get(' https://timgsa.喵/timg?image&quality=80&size=b9999_10000&sec=1599312363116&di=7bce180喵c6bade9bd8082dba0e7d01e&imgtype=0&src=http%3A%2F%2Fimgsrc.喵%2Fforum%2Fw%3D580%3Bcp%3Dtieba%2C10%2C661%3Bap%3D%25D0%25A4%25D3%25E2%25E9%25BB%25B0%25C9%2C90%2C669%2Fsign%3D5ed917b7d50735fa91f04eb1ae6a6cc3%2Ffe867c4a20a44623fc3610ce9922720e0ef3d7c7.jpg') with open('xyz.png','wb') as f: f.write(a.content)
pygame.init() # 初始 k=True#一个变量是否执行无限循环 pic=pygame.image.load('xyz.png') x=0 y=0 while k: a1=random.randint(1,255) a2 = random.randint(1, 255) a3 = random.randint(1, 255) screen = pygame.display.set_mode((800, 800)) bc=(a1,a2,a3) screen.fill(bc) for e in pygame.event.get():# pygame.event.get()触发事件 if e.type == pygame.QUIT: k=False screen.blit(pic,(x,y))#绑定对应位置,图像加载到screen屏幕上 pygame.display.update()#更新界面 x+=10 y+=10 if x+pic.get_width()>800or y+pic.get_height()>800: x=0 y=0 pygame.quit()#关闭


回复

上一页1 页 / 共 0下一页