python海龟画图的图案命令,python海龟绘图代码笑脸

本文详细介绍了如何使用Python的turtle库来绘制一个笑脸图形,包括脸型、眼睛、脸颊和嘴巴的绘制步骤,适合初学者学习和参考。
摘要由CSDN通过智能技术生成

这篇文章主要介绍了python用小海龟绘制漂亮的图形,具有一定借鉴价值,需要的朋友可以参考下。希望大家阅读完这篇文章后大有收获,下面让小编带着大家一起了解一下。

Source code download: 本文相关源码

Python编程 海龟库 绘制笑脸

import turtle
import time
# 绘制脸型
turtle.pencolor("gray")
turtle.fillcolor("yellow")
turtle.pensize(5)
turtle.begin_fill()
turtle.circle(100)
turtle.end_fill()

# 绘制左眼
turtle.penup()
turtle.goto(-30,130)
turtle.pendown()
turtle.setheading(90)
turtle.circle(20,180)

# 绘制右眼
turtle.penup()
turtle.goto(30,130)
turtle.pendown()
turtle.setheading(270)
turtle.circle(20,-180)

# 绘制左边脸颊
turtle.penup()
turtle.goto(-60,100)
turtle.pendown()
turtle.pencolor("pink")
turtle.dot(40)

# 绘制右边脸颊
turtle.penup()
turtle.goto(60,100)
turtle.pendown()
turtle.pencolor("pink")
turtle.dot(40)

# 绘制嘴巴
turtle.penup()
turtle.goto(-30,50)
turtle.pendown()
turtle.setheading(270)
turtle.pencolor("grey")
turtle.circle(30,180)

turtle.done()

  • 10
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值