基本方法:
import turtle as t
def draw():
t.hideturtle()
t.pensize(4)
t.color("red")
t.goto(50,0)
t.seth(90)
t.forward(50)
t.left(90)
t.forward(100)
t.left(90)
t.forward(100)
t.left(90)
t.forward(100)
t.left(90)
t.forward(50)
def draw_circle():
t.begin_fill()
t.hideturtle()
t.pensize(4)
l=50
t.color("red")
t.circle(l,360)
t.fillcolor("yellow")
t.end_fill()
draw()
draw_circle()
t.exitonclick() #turtle执行完后保留那个页面
用循环来实现
import turtle as t
def draw():
t.hideturtle()
t.pensize(4)
t.color("red")
t.forward(100)
t.left(90)
def draw_circle():
t.begin_fill()
t.hideturtle()
t.pensize(4)
l=50
t.color("red")
t.circle(l,360)
t.fillcolor("yellow")
t.end_fill()
t.goto(50,0)
t.left(90)
t.back(50)
t.clear()
for i in range(4):
draw()
t.seth(90)
t.forward(50)
draw_circle()
t.exitonclick() #turtle执行完后保留那个页面
标签:内嵌,draw,50,正方形,forward,90,circle,绘制,left
From: https://www.cnblogs.com/JK8395/p/16793613.html