1. 绘制奥运五环
import turtle
t = turtle.Pen()
t.width(8)
t.color('blue')
t.circle(50)
t.penup()
t.forward(130)
t.pendown()
t.color('black')
t.circle(50)
t.penup()
t.forward(130)
t.pendown()
t.color('red')
t.circle(50)
t.penup()
t.goto(66,-50)
t.pendown()
t.color('yellow')
t.circle(50)
t.penup()
t.forward(130)
t.pendown()
t.color('green')
t.circle(50)
2. 绘制五角星
import turtle
turtle.pensize(10)
turtle.pencolor("red")
turtle.penup()
turtle.goto(-100,100)
turtle.pendown()
turtle.fd(400)
turtle.right(144)
turtle.fd(400)
turtle.right(144)
turtle.fd(400)
turtle.right(144)
turtle.fd(400)
turtle.right(144)
turtle.fd(400)
3. 绘制八卦太极图
import turtle
pen=turtle.Pen()
def walk_pen(x,y):
pen.penup()
pen.goto(x,y)
pen.pendown()
turtle.screensize(400,300,'blue')
pen.color('black','black')
pen.pensize(5)
radius=200
pen.begin_fill()
pen.circle(radius / 2,180)
pen.circle(radius,180)
pen.left(180)
pen.circle(-radius / 2,180)
pen.end_fill()
pen.color('black','white')
walk_pen(0,0)
pen.begin_fill()
pen.circle(-radius / 2,-180)
pen.circle(-radius,-180)
pen.left(180)
pen.circle(radius / 2,-180)
pen.end_fill()
walk_pen(0,radius/3)
pen.begin_fill()
pen.circle(radius/6)
pen.end_fill()
pen.color('black','black')
walk_pen(0,-2*radius/3)
pen.begin_fill()
pen.circle(radius/6)
pen.end_fill()