Python 设置图像的位置
我已经添加了相关代码的图像。我的挑战是设置图像所需的位置。默认位置是画布的中心,如何更改,请帮助。Python 设置图像的位置,python,turtle-graphics,Python,Turtle Graphics,我已经添加了相关代码的图像。我的挑战是设置图像所需的位置。默认位置是画布的中心,如何更改,请帮助。 谢谢假设您已经加载了一些*.gif图像作为海龟的图像,那么您就可以在画布上的任何地方海龟.goto()(或海龟.setposition())和海龟.stamp()图像以将其留下: from turtle import Turtle, Screen # https://cdn-img.easyicon.net/png/10757/1075705.gif SQUIRREL_IMAGE = '107
谢谢假设您已经加载了一些*.gif图像作为海龟的图像,那么您就可以在画布上的任何地方
海龟.goto()
(或海龟.setposition()
)和海龟.stamp()
图像以将其留下:
from turtle import Turtle, Screen
# https://cdn-img.easyicon.net/png/10757/1075705.gif
SQUIRREL_IMAGE = '1075705.gif'
screen = Screen()
screen.register_shape(SQUIRREL_IMAGE)
turtle = Turtle(shape=SQUIRREL_IMAGE)
turtle.penup()
turtle.goto(100, 100)
turtle.stamp()
turtle.goto(-100, -100)
turtle.stamp()
turtle.hideturtle()
screen.exitonclick()
输出
请包括您的代码。