0
我已經通過蟒蛇中的龜創建了一片楓葉。我找到了一種方法來翻譯x和y軸上的形狀,但是我沒有找到一種方法來調整楓葉的大小,同時保持它的原始形式。如何使用x,y座標(烏龜圖形)重新生成圖像
import turtle
def MapleLeaf(x=None,y=None):
if x==None:
x=0
if y==None:
y=0
turtle.penup()
turtle.goto(1+x,-3+y)
turtle.pendown()
turtle.goto(5+x,-4+y)
turtle.goto(4+x,-3+y)
turtle.goto(9+x,1+y)
turtle.goto(7+x,2+y)
turtle.goto(8+x,5+y)
turtle.goto(5+x,4+y)
turtle.goto(5+x,5+y)
turtle.goto(3+x,4+y)
turtle.goto(4+x,9+y)
turtle.goto(2+x,7+y)
turtle.goto(0+x,10+y)
turtle.goto(-2+x,7+y)
turtle.goto(-4+x,8+y)
turtle.goto(-3+x,3+y)
turtle.goto(-5+x,6+y)
turtle.goto(-5+x,4+y)
turtle.goto(-8+x,5+y)
turtle.goto(-7+x,2+y)
turtle.goto(-9+x,1+y)
turtle.goto(-4+x,-3+y)
turtle.goto(-5+x,-4+y)
turtle.goto(0+x,-3+y)
turtle.goto(2+x,-7+y)
turtle.goto(2+x,-6+y)
turtle.goto(1+x,-3+y)
turtle.hideturtle()
turtle.pencolor("black")
turtle.fillcolor("red")
turtle.begin_fill()
MapleLeaf(50,50)
turtle.end_fill()
turtle.done()