大家好,小编为大家解答python用小海龟绘制漂亮的图形的问题。很多人还不知道python海龟画图的图案命令,现在让我们一起来看看吧!
Source code download: 本文相关源码
绘制可爱的笑脸
功能要求
使用海龟绘图画可爱的笑脸
说明:笑脸主要由三个圆形和一个弧线组成。笑脸的脸为黄色的圆形,眼睛为两个黑色圆形,嘴为黑色的弧线用python3.4画满天星。
实例代码
import turtle
t = turtle.Pen()
t.hideturtle()
#画脸
t.color('red','yellow')
t.begin_fill()
t.circle(50)
t.end_fill()
#移动画笔
t.penup()
t.goto(-20, 50)
t.pendown()
#画左眼
t.color('yellow', 'black')
t.begin_fill()
t.circle(10)
t.end_fill()
#移动画笔
t.penup()
t.goto(20, 50)
t.pendown()
#画右眼
t.color('yellow', 'black')
t.begin_fill()
t.circle(10)
t.end_fill()
#移动画笔
t.penu