首次绘图
>>> import turtle #导入 turtle 模块
>>> turtle.showturtle() #显示箭头
>>> turtle.write("攻城狮") #写字符串
>>> turtle.forward(300) #前进 300 像素
>>> turtle.color("red") #画笔颜色改为 red
>>> turtle.left(90) #箭头左转 90 度
>>> turtle.forward(300)
>>> turtle.goto(0,50) #去坐标(0,50)
>>> turtle.goto(0,0)
>>> turtle.penup() #抬笔。这样,路径就不会画出来
>>> turtle.goto(0,300)
>>> turtle.pendown() #下笔。这样,路径就会画出来
>>> turtle.circle(100) #画圆
绘制奥运五环标记
import turtle
turtle.width(10)
turtle.color("blue")
turtle.circle(50)
turtle.color("black")
turtle.penup()
turtle.goto(120,0)
turtle.pendown()
turtle.circle(50)
turtle.color("red")
turtle.penup()
turtle.goto(240,0)
turtle.pendown()
turtle.circle(50)
turtle.color("yellow")
turtle.penup()
turtle.goto(60,-50)
turtle.pendown()
turtle.circle(50)
turtle.color("green")
turtle.penup()
turtle.goto(180,-50)
turtle.pendown()
turtle.circle(50)
四个矩形
import turtle
turtle.width(10)
turtle.color("blue")
turtle.goto(150,0)
turtle.goto(150,150)
turtle.goto(0,150)
turtle.goto(0,0)
turtle.penup()
turtle.goto(200,0)
turtle.pendown()
turtle.goto(350,0)
turtle.goto(350,150)
turtle.goto(200,150)
turtle.goto(200,0)
turtle.penup()
turtle.goto(200,200)
turtle.pendown()
turtle.goto(350,200)
turtle.goto(350,350)
turtle.goto(200,350)
turtle.goto(200,200)
turtle.penup()
turtle.goto(0,200)
turtle.pendown()
turtle.goto(150,200)
turtle.goto(150,350)
turtle.goto(0,350)
turtle.goto(0,200)