Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/302.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在python turtle中是否可以更改海龟的大小?_Python_Turtle Graphics - Fatal编程技术网

在python turtle中是否可以更改海龟的大小?

在python turtle中是否可以更改海龟的大小?,python,turtle-graphics,Python,Turtle Graphics,我试过塑身和套头衫都不管用, 还有别的选择吗 其他的都可以,我只需要一个长方形 class Sword(turtle.Turtle): def __init__(self,plyr,color): turtle.Turtle.__init__(self) self.player = plyr self.speed(0) self.up() self.f

我试过塑身和套头衫都不管用, 还有别的选择吗

其他的都可以,我只需要一个长方形

    class Sword(turtle.Turtle):

        def __init__(self,plyr,color):
            turtle.Turtle.__init__(self)
            self.player = plyr
            self.speed(0)
            self.up()
            self.fd(25)
            self.goto(self.player.xcor(),self.player.ycor())
            self.shape("square")
            self.color(color)

        def collision(self):
            global zombies
            for x in range(len(zombies)-1,-1,-1):
                if self.distance(zombies[x]) <= 20:
            zombies[x].ht()
            del zombies[x]
            return True;
    s = Sword(p1,"blue")
类剑(乌龟,乌龟):
定义初始值(自身、plyr、颜色):
乌龟。乌龟。uuu初始(自我)
self.player=plyr
自身速度(0)
self.up()
self.fd(25)
self.goto(self.player.xcor(),self.player.ycor())
自形(“方形”)
自我颜色(颜色)
def碰撞(自):
全球僵尸
对于范围内的x(len(僵尸)-1,-1,-1):
如果自我距离(僵尸[x])


如果要更改海龟/形状的大小,应尝试使用shapesize()函数。希望这有帮助

如果要更改海龟/形状的大小,应尝试使用shapesize()函数。希望这有帮助

那么你的问题是有可能改变海龟的形状吗?可能的复制品那么你的问题是有可能改变海龟的形状吗?可能的复制品
import turtle
t = turtle.Turtle()
t.shape('square')
t.shapesize(2.0, 1.0, 1) # width, len, outline