用户:
泡杯查看:8 回复:4 评论:8 创建时间:2021-06-20T18:37:51
如题
大佬求助啊!!!
import pygame
from pygame.locals import *
import os
import sys
import time
pygame.init()
screen = pygame.display.set_mode((480,喵0), 0, 32)
imgsDir = "D:/lsk/framebuffer/2/frames/"
imgs = []
def loadImageNames():
global imgs
for root,dirs,files in os.walk(imgsDir):
for file in files:
if file.endswith(".jpg"):
imgs.append(imgsDir + file)
loadImageNames()
index = 0
while True:
if index >= len(imgs):
index = 0
img = pygame.image.load(imgs[index]).convert()
screen.blit(img, (0, 0))
pygame.display.update()
for event in pygame.event.get():
if event.type == QUIT:
sys.exit()
index += 1
time.sleep(1 / 9)
我第一次用pygame,可能有点问题……
那个imgsdir变量就是图片的路径,然后sleep方法参数是相邻两张图片之间的时间
点赞0
评论