使用pygame将多帧/移动.gif图像加载到python中 [英] Loading a multiframe/moving .gif image into python using pygame

查看:1032
本文介绍了使用pygame将多帧/移动.gif图像加载到python中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道使用pygame将.gif图像加载到python中的简单方法吗?我尝试使用'pygame.image.load(path)'加载.gif图像,尽管只加载了第一帧,该图像仍然有效.因为我不得不使用循环一次显示多个图像.

Does anyone know a simple way to load a .gif image into python using pygame? I tried loading a .gif image using 'pygame.image.load(path)' which worked although only the first frame loaded.Ever since I had to use a loop to display multiple images at once.

推荐答案

简而言之,除非您使用额外的库,否则您将无法在Pygame中显示多帧GIF.而是,爆炸您的GIF.您将必须手动执行所有操作,因为Pygame无法控制流程时间等,这对于动画GIF来说是必需的.

Simply put, you cannot display multi-frame GIFs in Pygame, unless you use an extra library. Instead, explode your GIF. You will have to do everything manually, as Pygame does not control flow time, etc, which is necessary for animated GIFs.

这篇关于使用pygame将多帧/移动.gif图像加载到python中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆