【问题标题】:Is it possible to change the size of the turtle in python Turtle?是否可以在 python Turtle 中更改海龟的大小?
【发布时间】:2019-05-10 19:48:53
【问题描述】:

我试过 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")

【问题讨论】:

标签: python turtle-graphics


【解决方案1】:
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.

【讨论】:

    【解决方案2】:

    如果你想改变海龟/形状的大小,你应该尝试使用 shapesize() 函数。希望这会有所帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-08-16
      • 2022-01-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多