猫史档案馆


【Python作品分享】新的作品【作品秀】

用户:于老师于老师查看:0 回复:1 评论:0 创建时间:2020-08-27T13:53:10


【作品展示】

center_image

 

【作品介绍】

 

【作品源代码】

import turtle
import turtle as t
from turtle import *


# 画玫瑰花的代码是参考网上的, 文字添加代码是自己写的,画布大小是自己设置的

# 设置画布大小
# turtle.screensize(canvwidth=None, canvheight=None, bg=None)

turtle.setup(width=0.6, height=0.6)
# 设置初始位置
turtle.penup()
turtle.left(90)
turtle.forward(200)
turtle.pendown()
turtle.right(90)

# 输出文字
printer = turtle.Turtle()
printer.hideturtle()
printer.penup()
printer.backward(200)
printer.write("So beautiful !\n\n", align="right", font=("楷体", 16, "bold"))
printer.write("           from 赵诗涵", align="center", font=("楷体", 12, "normal"))

# 花蕊
turtle.fillcolor('red')
turtle.begin_fill()
turtle.circle(10, 180)
turtle.circle(25, 110)
turtle.left(50)
turtle.circle(60, 45)
turtle.circle(20, 170)
turtle.right(24)
turtle.forward(30)
turtle.left(10)
turtle.circle(30, 110)
turtle.forward(20)
turtle.left(40)
turtle.circle(90, 70)
turtle.circle(30, 150)
turtle.right(30)
turtle.forward(15)
turtle.circle(80, 90)
turtle.left(15)
turtle.forward(45)
turtle.right(165)
turtle.forward(20)
turtle.left(155)
turtle.circle(150, 80)
turtle.left(50)
turtle.circle(150, 90)
turtle.end_fill()

# 花瓣1
turtle.left(150)
turtle.circle((-90), 70)
turtle.left(20)
turtle.circle(75, 105)
turtle.setheading(60)
turtle.circle(80, 98)
turtle.circle((-90), 40)

# 花瓣2
turtle.left(180)
turtle.circle(90, 40)
turtle.circle((-80), 98)
turtle.setheading((-83))

# 叶子1
turtle.forward(30)
turtle.left(90)
turtle.forward(25)
turtle.left(45)
turtle.fillcolor('green')
turtle.begin_fill()
turtle.circle((-80), 90)
turtle.right(90)
turtle.circle((-80), 90)
turtle.end_fill()

turtle.right(135)
turtle.forward(60)
turtle.left(180)
turtle.forward(85)
turtle.left(90)
turtle.forward(80)

# 叶子2
turtle.right(90)
turtle.right(45)
turtle.fillcolor('green')
turtle.begin_fill()
turtle.circle(80, 90)
turtle.left(90)
turtle.circle(80, 90)
turtle.end_fill()

turtle.left(135)
turtle.forward(60)
turtle.left(180)
turtle.forward(60)
turtle.right(90)
turtle.circle(200, 60)

printer = turtle.Turtle()
printer.hideturtle()
printer.penup()
printer.backward(400)
printer.write("吃着吃着!\n\n", align="right", font=("楷体", 16, "bold"))
turtle.clear()
# 设置画笔的大小
t.pensize(4)
# 设置GBK颜色范围为0-255
t.colormode(255)
# 设置画笔颜色和填充颜色(pink)
t.color((255, 155, 192), "pink")
# 设置主窗口的大小为840*500
t.setup(840, 500)
# 设置画笔速度为10
t.speed(100)
# 鼻子
# 提笔
t.penup()
# 画笔前往坐标(-100,100)
t.goto((-100), 100)
# 下笔
t.pendown()
# 笔的角度为-30°
t.setheading((-30))
# 外形填充的开始标志
t.begin_fill()
a = 0.4
for i in range(120):
    if (0 <= i < 30 or 60 <= i < 90):
        a = (a + 0.08)
        # 向左转3度
        t.left(3)
        #     向前走a的步长
        t.forward(a)
    else:
        a = (a - 0.08)
        t.left(3)
        t.forward(a)
# 依据轮廓填充
t.end_fill()
# 提笔
t.penup()
# 笔的角度为90度
t.setheading(90)
# 向前移动25
t.forward(25)
# 转换画笔的角度为0
t.setheading(0)
t.forward(10)
t.pendown()
# 设置画笔颜色
t.pencolor(255, 155, 192)
t.setheading(10)
t.begin_fill()
# 画一个半径为5的圆
t.circle(5)
# 设置画笔和填充颜色
t.color(160, 82, 45)
t.end_fill()
t.penup()
t.setheading(0)
t.forward(20)
t.pendown()
t.pencolor(255, 155, 192)
t.setheading(10)
t.begin_fill()
t.circle(5)
t.color(160, 82, 45)
t.end_fill()
# 头
t.color((255, 155, 192), "pink")
t.penup()
t.setheading(90)
t.forward(41)
t.setheading(0)
t.forward(0)
t.pendown()
t.begin_fill()
t.setheading(180)
# 顺时针画一个半径为300,圆心角为30°的园
t.circle(300, (-30))
t.circle(100, (-60))
t.circle(80, (-100))
t.circle(150, (-20))
t.circle(60, (-95))
t.setheading(161)
t.circle((-300), 15)
t.penup()
t.goto((-100), 100)
t.pendown()
t.setheading((-30))
a = 0.4
for i in range(60):
    if (0 <= i < 30 or 60 <= i < 90):
        a = (a + 0.08)
        # 向左转3度
        t.left(3)
        #     向前走a的步长
        t.forward(a)
    else:
        a = (a - 0.08)
        t.left(3)
        t.forward(a)
t.end_fill()
# 耳朵
t.color((255, 155, 192), "pink")
t.penup()
t.setheading(90)
t.forward((-7))
t.setheading(0)
t.forward(70)
t.pendown()
t.begin_fill()
t.setheading(100)
t.circle((-50), 50)
t.circle((-10), 120)
t.circle((-50), 54)
t.end_fill()
t.penup()
t.setheading(90)
t.forward((-12))
t.setheading(0)
t.forward(30)
t.pendown()
t.begin_fill()
t.setheading(100)
t.circle((-50), 50)
t.circle((-10), 120)
t.circle((-50), 56)
t.end_fill()
# 眼睛
t.color((255, 155, 192), "white")
t.penup()
t.setheading(90)
t.forward((-20))
t.setheading(0)
t.forward((-95))
t.pendown()
t.begin_fill()
t.circle(15)
t.end_fill()
t.color("black")
t.penup()
t.setheading(90)
t.forward(12)
t.setheading(0)
t.forward((-3))
t.pendown()
t.begin_fill()
t.circle(3)
t.end_fill()
t.color((255, 155, 192), "white")
t.penup()
t.setheading(90)
t.forward((-25))
t.setheading(0)
t.forward(40)
t.pendown()
t.begin_fill()
t.circle(15)
t.end_fill()
t.color("black")
t.penup()
t.setheading(90)
t.forward(12)
t.setheading(0)
t.forward((-3))
t.pendown()
t.begin_fill()
t.circle(3)
t.end_fill()
# 腮
t.color((255, 155, 192))
t.penup()
t.setheading(90)
t.forward((-95))
t.setheading(0)
t.forward(65)
t.pendown()
t.begin_fill()
t.circle(30)
t.end_fill()
# 嘴
t.color(239, 69, 19)
t.penup()
t.setheading(90)
t.forward(15)
t.setheading(0)
t.forward((-100))
t.pendown()
t.setheading((-80))
t.circle(30, 40)
t.circle(40, 80)
# 身体
t.color("red", (255, 99, 71))
t.penup()
t.setheading(90)
t.forward((-20))
t.setheading(0)
t.forward((-78))
t.pendown()
t.begin_fill()
t.setheading((-130))
t.circle(100, 10)
t.circle(300, 30)
t.setheading(0)
t.forward(230)
t.setheading(90)
t.circle(300, 30)
t.circle(100, 3)
t.color((255, 155, 192), (255, 100, 100))
t.setheading((-135))
t.circle((-80), 63)
t.circle((-150), 24)
t.end_fill()
# 手
t.color((255, 155, 192))
t.penup()
t.setheading(90)
t.forward((-40))
t.setheading(0)
t.forward((-27))
t.pendown()
t.setheading((-160))
t.circle(300, 15)
t.penup()
t.setheading(90)
t.forward(15)
t.setheading(0)
t.forward(0)
t.pendown()
t.setheading((-10))
t.circle((-20), 90)
t.penup()
t.setheading(90)
t.forward(30)
t.setheading(0)
t.forward(237)
t.pendown()
t.setheading((-20))
t.circle((-300), 15)
t.penup()
t.setheading(90)
t.forward(20)
t.setheading(0)
t.forward(0)
t.pendown()
t.setheading((-170))
t.circle(20, 90)
# 脚
t.pensize(10)
t.color((240, 128, 128))
t.penup()
t.setheading(90)
t.forward((-75))
t.setheading(0)
t.forward((-180))
t.pendown()
t.setheading((-90))
t.forward(40)
t.setheading((-180))
t.color("black")
t.pensize(15)
t.forward(20)
t.pensize(10)
t.color((240, 128, 128))
t.penup()
t.setheading(90)
t.forward(40)
t.setheading(0)
t.forward(90)
t.pendown()
t.setheading((-90))
t.forward(40)
t.setheading((-180))
t.color("black")
t.pensize(15)
t.forward(20)
# 尾巴
t.pensize(4)
t.color((255, 155, 192))
t.penup()
t.setheading(90)
t.forward(70)
t.setheading(0)
t.forward(95)
t.pendown()
t.setheading(0)
t.circle(70, 20)
t.circle(10, 330)
t.circle(70, 30)
turtle.done()

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
爱python的小萌新爱python的小萌新

requests-sofa~~

点赞0


评论