【问题标题】:How open a GIF image in with turtle?如何用turtle打开GIF图像?
【发布时间】:2021-03-02 18:42:44
【问题描述】:

我尝试为我的 GIF 图像设置动画,但它不起作用,这是我的代码:

import turtle
screen = turtle.Screen()

t1 = turtle.Turtle()
screen.addshape('black.gif')
t1.shape('black.gif')
turtle.done()

【问题讨论】:

    标签: python turtle-graphics animated-gif


    【解决方案1】:

    确保你的 python 代码和你的 gif 在同一个文件夹中,然后试试这个代码:

    import turtle
    screen = turtle.Screen()
    screen.setup(500, 500) # You can change the dimensions(500, 500) to any number
    t = turtle.Turlte()
    screen.addshape("name_of_the_gif.gif") #don't forget they have to be in the same file
    t.shape("name_of_the_gif.gif")# make the same gif as the screen.addshape
    

    【讨论】:

      猜你喜欢
      • 2016-11-20
      • 2021-07-03
      • 2022-01-15
      • 2011-07-11
      • 2014-05-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-21
      相关资源
      最近更新 更多