是否可以在python Turtle中更改乌龟的大小?

时间:2019-05-10 19:48:53

标签: python turtle-graphics

我尝试过shapesize和turtlesize都行不通, 有其他选择吗?

一切正常,我只需要一个矩形

    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")

2 个答案:

答案 0 :(得分:0)

import turtle
t = turtle.Turtle()
t.shape('square')
t.shapesize(2.0, 1.0, 1) # width, len, outline

The full documentation for the turtle module is readily available.

答案 1 :(得分:0)

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