我正在尝试创建一个正方形序列,每个正方形居中。我编写了代码以将笔的位置偏移(5,-5),但无法使正方形居中。
def drawSquareSequance(myTurtle, maxSide, minSide):
for sidelength in range(maxSide, minSide, -5):
for square in range(4):
myTurtle.forward(sidelength)
myTurtle.right(90)
for newPos in range(1, 10, -5):
myTurtle.penup()
myTurtle.setposition(newPos, newPos) #trying to place coordinates here
myTurtle.pendown()
drawSquareSequance(t,150,100)
任何帮助都太棒了!