如何在 Python 中使用乌龟模块播放 GIF? [英] How to play GIF's using turtle module in Python?

查看:28
本文介绍了如何在 Python 中使用乌龟模块播放 GIF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望 GIF 在海龟屏幕中播放.但它只显示静止图像.请解决这个问题,任何帮助将不胜感激...

I want the GIF to play in the turtle screen. But it is showing only the still image. Please fix this, Any help will be appreciated...

这是我的代码:

import turtle
import os

# resources :
bgpic = r"C:\Users\intel\Desktop\xBDT7.gif"


win = turtle.Screen()
win.addshape(bgpic)

sh = turtle.Turtle()
sh.shape(bgpic)


# Shuting the window down :
turtle.mainloop()

推荐答案

来自阅读 turtle 文档,此处,我没有看到任何说明可以在乌龟内播放动画 gif 的内容.您可以自行阅读文档,但看起来虽然在海龟中使用图像作为形状或背景,但它需要是 .gif 文件,您实际上无法在海龟中播放动画 gif.

From reading the turtle documentation, here, I don't see anything that says animated gifs can be played within turtle. You are free to read the documentation yourself, but It appears that although to use an image as a shape or background in turtle, it needs to be a .gif file, you cannot actually playback animated gifs in turtle.

这篇关于如何在 Python 中使用乌龟模块播放 GIF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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