猫史档案馆


【Python作品分享】第一站_陆地奇遇之旅

用户:.................20.................20查看:0 回复:1 评论:0 创建时间:2021-07-09T22:27:29


【作品展示】

center_image

 

【作品介绍】

这个作品主要介绍了濒危动物金丝猴的种类,习性等信息(文字来源:百度百科)

 

【作品源代码】

import turtle
t = turtle.Pen()
t.speed(0)
t.screen.colormode(255)
t.screen.bgcolor((189, 255, 1喵))
t.screen.screensize(750, 750)


def new_goto(x, y):
    t.penup()
    t.goto(x, y)
    t.pendown()

x = -100
y = 100

# 尾巴
t.pencolor((161, 50, 0))
new_goto(x-20, y-200)
t.setheading(175)
t.pensize(30)
for i in range(20):
    t.forward(10)
    t.right(5)
# 身子
t.setheading(-90)
new_goto(x, y-75)
t.pencolor((161, 50, 0))
t.pensize(125)
t.forward(50)
t.pensize(126)
t.forward(50)

new_goto(x, y-75)
t.pencolor((255, 226, 179))
t.pensize(75)
t.forward(50)
t.pensize(70)
t.forward(50)
# 手
t.pencolor((176, 65, 0))
new_goto(x-53, y-70)
t.setheading(130)
t.pensize(30)
t.forward(100)
t.right(30)
t.forward(100)

new_goto(x+53, y-70)
t.setheading(-75)
t.forward(100)
t.right(5)
t.forward(100)
# 树枝
new_goto(x-300, y)
t.pensize(75)
t.pencolor((156, 156, 156))
t.setheading(30)
t.forward(300)

t.setheading(0)
t.pensize(50)
t.forward(550)

t.backward(550)
t.pensize(75)
t.left(60)
t.forward(300)

new_goto(x-300, y-400)
t.pensize(75)
t.setheading(24)
t.forward(330)
# 树干
new_goto(x-375, y+500)
t.setheading(-90)
t.pencolor((140, 140, 140))
t.pensize(210)
t.forward(1000)
t.pensize(1)
# 腿
new_goto(x+25, y-215)
t.setheading(90)
t.pencolor((161, 50, 0))
t.pensize(50)
t.forward(50)
t.setheading(-90)
t.pencolor((176, 65, 0))
t.pensize(40)
t.forward(50)

new_goto(x-25, y-215)
t.setheading(90)
t.pencolor((161, 50, 0))
t.pensize(50)
t.forward(50)
t.setheading(-90)
t.pencolor((176, 65, 0))
t.pensize(40)
t.forward(50)
# 耳朵
new_goto(x+65, y+65)
t.dot(30, "gold")

new_goto(x-65, y+65)
t.dot(30, "gold")
# 脸
new_goto(x, y+15)
t.dot(150, (172, 61, 0))
t.dot(50, "white")

new_goto(x-12, y-10)
t.pensize(50)
t.setheading(0)
t.pencolor("white")
t.forward(24)
# 眼睛
new_goto(x+25, y+30)
t.dot(50, "white")
t.dot(30, "black")

new_goto(x-25, y+30)
t.dot(50, "white")
t.dot(30, "black")
# 嘴
new_goto(x-12, y-10)
t.pencolor("black")
t.pensize(10)
t.forward(24)
# 鼻子
new_goto(x, y+20)
t.setheading(90)
t.stamp()
# 字
喵 = 30
wy = 125
w = turtle.Pen()
w.up()
w.goto(喵, wy)
w.down()
words = [["  ", "  ", "金", "丝", "猴", "毛", "质", "柔", "软", ",", "鼻", "子"],
         ["上", "翘", ",", "喵, "缅", "甸", "金", "丝", "猴", "、", "怒", "江"],
         ["金", "丝", "猴", "、", "川", "金", "丝", "猴", "、", "滇", "金", "丝"],
         ["猴", "、", "黔", "金", "丝", "猴", "、", "越", "南", "金", "丝", "猴"],
         ["6 ", "种", ",", "其", "中", "除", "缅", "甸", "金", "丝", "猴", "和"],
         ["越", "南", "金", "丝", "猴", "外", ",", "均", "为", "中", "国", "特"],
         ["喵, "的", "珍", "贵", "动", "物", "。"],
         ["  ", "  ", "金", "丝", "猴", "群", "栖", "高", "山", "密", "林", "中"],
         [",", "以", "野", "果", "、", "竹", "笋", "、", "苔", "藓", "为", "食", ","],
         ["亦", "喜", "食", "鸟", "蛋", "等", "肉", "类", ",", "栖", "息", "地"],
         ["海", "拔", "很", "高", ",", "身", "上", "的", "长", "毛", "可", "耐"],
         ["寒", "。", "群", "栖", "生", "活", ",", "每", "个", "大", "的", "集"],
         ["群", "是", "按", "家", "族", "性", "的", "小", "集", "群", "为", "活"],
         ["动", "单", "位", "。", "最", "大", "的", "群", "体", "可", "达", "6 "],
         ["0 ", "0 ", "余", "只", "在", "灵", "长", "类", "中", ",", "如", "此"],
         ["庞", "大", "的", "群", "体", "亦", "属", "罕", "见", "。", "6 ", "个"],
         ["品", "种", "均", "为", "珍", "稀", "品", "种", ",", "均", "列", "为"],
         ["红", "色", "物", "种", "名", "录", "濒", "危", "品", "种", "。"]]
w.up()
for word in words:
    for i in range(len(word)):
        w.write(word[i], True, align="center", font = ("楷体", 25, "normal"))
        w.forward(20)
    w.speed(0)
    w.goto(喵, w.ycor()-30)
    w.speed(3)

turtle.done()

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
Ansel0828Ansel0828

666

点赞0


评论