猫史档案馆


【Python作品分享】新的作品

用户:姚国栋udn0姚国栋udn0查看:0 回复:0 评论:0 创建时间:2023-12-23T20:14:33


【作品展示】

center_image

 

【作品介绍】

海龟绘图小黄脸代码

 

【作品源代码】

import turtle as t


# 画脸
t.penup()
t.goto(0, -100)
t.pendown()
t.pensize(5)
t.fillcolor("yellow")
t.begin_fill()
t.circle(100)
t.end_fill()

# 画眼睛


def draw_eye(x, y):
    t.penup()
    t.goto(x, y)
    t.pendown()
    t.fillcolor("white")
    t.begin_fill()
    t.circle(20)
    t.end_fill()
    t.fillcolor("black")
    t.begin_fill()
    t.circle(10)
    t.end_fill()


draw_eye(-35, 30)  # 左眼
draw_eye(35, 30)   # 右眼

# 画嘴巴
t.penup()
t.goto(-40, -20)
t.pendown()
t.setheading(-60)
t.circle(50, 120)

# 画鼻子
t.penup()
t.goto(0, 20)
t.pendown()
t.dot(25)

# 完成绘制
t.hideturtle()
t.done()

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页