51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 1379|回复: 0
打印 上一主题 下一主题

[转贴] 没抢到冰墩墩,那咱们自己用python画一个

[复制链接]
  • TA的每日心情
    擦汗
    4 天前
  • 签到天数: 1042 天

    连续签到: 4 天

    [LV.10]测试总司令

    跳转到指定楼层
    1#
    发表于 2022-2-22 10:15:26 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
     兄弟们,冰墩墩人人都想要,但是咱们实在是抢不赢单身几十年的那些手速,哎,单身就是好!
      虽然咱们抢不赢,但是万幸,还有python,咱们可以自己画一个送给最棒的自己~
      准备工作
      首先咱们需要Python环境和pycharm编辑器,有别的也可以,但我一直认为pycharm才是和Python最配的~
      然后安装一个 turtle 模块。
      效果展示
      咱们干脆点,直接上冰墩墩.jpg,待会上冰墩墩.py

    主要代码展示
      名字
    turtle.title('PythonBingDunDun(冰墩墩啊冰墩墩)')

     画笔速度

    turtle.speed(10)



     左手
      turtle.penup()
      turtle.goto(177, 112)
      turtle.pencolor("lightgray")
      turtle.pensize(3)
      turtle.fillcolor("white")
      turtle.begin_fill()
      turtle.pendown()
      turtle.setheading(80)
      turtle.circle(-45, 200)
      turtle.circle(-300, 23)
      turtle.end_fill()



    左手内
    turtle.penup()
      turtle.goto(182, 95)
      turtle.pencolor("black")
      turtle.pensize(1)
      turtle.fillcolor("black")
      turtle.begin_fill()
      turtle.setheading(95)
      turtle.pendown()
      turtle.circle(-37, 160)
      turtle.circle(-20, 50)
      turtle.circle(-200, 30)
      turtle.end_fill()



    轮廓
      头顶
    turtle.penup()
      turtle.goto(-73, 230)
      turtle.pencolor("lightgray")
      turtle.pensize(3)
      turtle.fillcolor("white")
      turtle.begin_fill()
      turtle.pendown()
      turtle.setheading(20)
      turtle.circle(-250, 35)



     左耳
    turtle.setheading(50)
      turtle.circle(-42, 180)



    左侧
    turtle.setheading(-50)
      turtle.circle(-190, 30)
      turtle.circle(-320, 45)



    左腿
    turtle.circle(120, 30)
      turtle.circle(200, 12)
      turtle.circle(-18, 85)
      turtle.circle(-180, 23)
      turtle.circle(-20, 110)
      turtle.circle(15, 115)
      turtle.circle(100, 12)



    右腿
    turtle.circle(15, 120)
      turtle.circle(-15, 110)
      turtle.circle(-150, 30)
      turtle.circle(-15, 70)
      turtle.circle(-150, 10)
      turtle.circle(200, 35)
      turtle.circle(-150, 20)



    右手
    turtle.setheading(-120)
      turtle.circle(50, 30)
      turtle.circle(-35, 200)
      turtle.circle(-300, 23)

    右侧

    turtle.setheading(86)
      turtle.circle(-300, 26)

    右耳

    turtle.setheading(122)
      turtle.circle(-53, 160)
      turtle.end_fill()

    右耳内

    turtle.penup()
      turtle.goto(-130, 180)
      turtle.pencolor("black")
      turtle.pensize(1)
      turtle.fillcolor("black")
      turtle.begin_fill()
      turtle.pendown()
      turtle.setheading(120)
      turtle.circle(-28, 160)
      turtle.setheading(210)
      turtle.circle(150, 20)
      turtle.end_fill()

    左耳内

    turtle.penup()
      turtle.goto(90, 230)
      turtle.setheading(40)
      turtle.begin_fill()
      turtle.pendown()
      turtle.circle(-30, 170)
      turtle.setheading(125)
      turtle.circle(150, 23)
      turtle.end_fill()

     右手内

    turtle.penup()
      turtle.goto(-180, -55)
      turtle.fillcolor("black")
      turtle.begin_fill()
      turtle.setheading(-120)
      turtle.pendown()
      turtle.circle(50, 30)
      turtle.circle(-27, 200)
      turtle.circle(-300, 20)
      turtle.setheading(-90)
      turtle.circle(300, 14)
      turtle.end_fill()

    左腿内

    turtle.penup()
      turtle.goto(108, -168)
      turtle.fillcolor("black")
      turtle.begin_fill()
      turtle.pendown()
      turtle.setheading(-115)
      turtle.circle(110, 15)
      turtle.circle(200, 10)
      turtle.circle(-18, 80)
      turtle.circle(-180, 13)
      turtle.circle(-20, 90)
      turtle.circle(15, 60)
      turtle.setheading(42)
      turtle.circle(-200, 29)
      turtle.end_fill()

    右腿内

    turtle.penup()
      turtle.goto(-38, -210)
      turtle.fillcolor("black")
      turtle.begin_fill()
      turtle.pendown()
      turtle.setheading(-155)
      turtle.circle(15, 100)
      turtle.circle(-10, 110)
      turtle.circle(-100, 30)
      turtle.circle(-15, 65)
      turtle.circle(-100, 10)
      turtle.circle(200, 15)
      turtle.setheading(-14)
      turtle.circle(-200, 27)
      turtle.end_fill()

     右眼
      眼圈
    turtle.penup()
      turtle.goto(-64, 120)
      turtle.begin_fill()
      turtle.pendown()
      turtle.setheading(40)
      turtle.circle(-35, 152)
      turtle.circle(-100, 50)
      turtle.circle(-35, 130)
      turtle.circle(-100, 50)
      turtle.end_fill()

    眼珠

    turtle.penup()
      turtle.goto(-47, 55)
      turtle.fillcolor("white")
      turtle.begin_fill()
      turtle.pendown()
      turtle.setheading(0)
      turtle.circle(25, 360)
      turtle.end_fill()
      turtle.penup()
      turtle.goto(-45, 62)
      turtle.pencolor("darkslategray")
      turtle.fillcolor("darkslategray")
      turtle.begin_fill()
      turtle.pendown()
      turtle.setheading(0)
      turtle.circle(19, 360)
      turtle.end_fill()
      turtle.penup()
      turtle.goto(-45, 68)
      turtle.fillcolor("black")
      turtle.begin_fill()
      turtle.pendown()
      turtle.setheading(0)
      turtle.circle(10, 360)
      turtle.end_fill()
      turtle.penup()
      turtle.goto(-47, 86)
      turtle.pencolor("white")
      turtle.fillcolor("white")
      turtle.begin_fill()
      turtle.pendown()
      turtle.setheading(0)
      turtle.circle(5, 360)
      turtle.end_fill()




    左眼
      眼圈
    turtle.penup()
      turtle.goto(51, 82)
      turtle.fillcolor("black")
      turtle.begin_fill()
      turtle.pendown()
      turtle.setheading(120)
      turtle.circle(-32, 152)
      turtle.circle(-100, 55)
      turtle.circle(-25, 120)
      turtle.circle(-120, 45)
      turtle.end_fill()



     眼珠
    turtle.penup()
      turtle.goto(79, 60)
      turtle.fillcolor("white")
      turtle.begin_fill()
      turtle.pendown()
      turtle.setheading(0)
      turtle.circle(24, 360)
      turtle.end_fill()
      turtle.penup()
      turtle.goto(79, 64)
      turtle.pencolor("darkslategray")
      turtle.fillcolor("darkslategray")
      turtle.begin_fill()
      turtle.pendown()
      turtle.setheading(0)
      turtle.circle(19, 360)
      turtle.end_fill()
      turtle.penup()
      turtle.goto(79, 70)
      turtle.fillcolor("black")
      turtle.begin_fill()
      turtle.pendown()
      turtle.setheading(0)
      turtle.circle(10, 360)
      turtle.end_fill()
      turtle.penup()
      turtle.goto(79, 88)
      turtle.pencolor("white")
      turtle.fillcolor("white")
      turtle.begin_fill()
      turtle.pendown()
      turtle.setheading(0)
      turtle.circle(5, 360)
      turtle.end_fill()

     鼻子

    turtle.penup()
      turtle.goto(37, 80)
      turtle.fillcolor("black")
      turtle.begin_fill()
      turtle.pendown()
      turtle.circle(-8, 130)
      turtle.circle(-22, 100)
      turtle.circle(-8, 130)
      turtle.end_fill()

     嘴

     turtle.penup()
      turtle.goto(-15, 48)
      turtle.setheading(-36)
      turtle.begin_fill()
      turtle.pendown()
      turtle.circle(60, 70)
      turtle.setheading(-132)
      turtle.circle(-45, 100)
      turtle.end_fill()

     彩虹圈

    1.  turtle.penup()
    2.   turtle.goto(-135, 120)
    3.   turtle.pensize(5)
    4.   turtle.pencolor("cyan")
    5.   turtle.pendown()
    6.   turtle.setheading(60)
    7.   turtle.circle(-165, 150)
    8.   turtle.circle(-130, 78)
    9.   turtle.circle(-250, 30)
    10.   turtle.circle(-138, 105)
    11.   turtle.penup()
    12.   turtle.goto(-131, 116)
    13.   turtle.pencolor("slateblue")
    14.   turtle.pendown()
    15.   turtle.setheading(60)
    16.   turtle.circle(-160, 144)
    17.   turtle.circle(-120, 78)
    18.   turtle.circle(-242, 30)
    19.   turtle.circle(-135, 105)
    20.   turtle.penup()
    21.   turtle.goto(-127, 112)
    22.   turtle.pencolor("orangered")
    23.   turtle.pendown()
    24.   turtle.setheading(60)
    25.   turtle.circle(-155, 136)
    26.   turtle.circle(-116, 86)
    27.   turtle.circle(-220, 30)
    28.   turtle.circle(-134, 103)
    29.   turtle.penup()
    30.   turtle.goto(-123, 108)
    31.   turtle.pencolor("gold")
    32.   turtle.pendown()
    33.   turtle.setheading(60)
    34.   turtle.circle(-150, 136)
    35.   turtle.circle(-104, 86)
    36.   turtle.circle(-220, 30)
    37.   turtle.circle(-126, 102)
    38.   turtle.penup()
    39.   turtle.goto(-120, 104)
    40.   turtle.pencolor("greenyellow")
    41.   turtle.pendown()
    42.   turtle.setheading(60)
    43.   turtle.circle(-145, 136)
    44.   turtle.circle(-90, 83)
    45.   turtle.circle(-220, 30)
    46.   turtle.circle(-120, 100)
    47.   turtle.penup()
    复制代码
    爱心

    turtle.penup()
      turtle.goto(220, 115)
      turtle.pencolor("brown")
      turtle.pensize(1)
      turtle.fillcolor("brown")
      turtle.begin_fill()
      turtle.pendown()
      turtle.setheading(36)
      turtle.circle(-8, 180)
      turtle.circle(-60, 24)
      turtle.setheading(110)
      turtle.circle(-60, 24)
      turtle.circle(-8, 180)
      turtle.end_fill()

    五环

     turtle.penup()
      turtle.goto(-5, -170)
      turtle.pendown()
      turtle.pencolor("blue")
      turtle.circle(6)
      turtle.penup()
      turtle.goto(10, -170)
      turtle.pendown()
      turtle.pencolor("black")
      turtle.circle(6)
      turtle.penup()
      turtle.goto(25, -170)
      turtle.pendown()
      turtle.pencolor("brown")
      turtle.circle(6)
      turtle.penup()
      turtle.goto(2, -175)
      turtle.pendown()
      turtle.pencolor("lightgoldenrod")
      turtle.circle(6)
      turtle.penup()
      turtle.goto(16, -175)
      turtle.pendown()
      turtle.pencolor("green")
      turtle.circle(6)
      turtle.penup()







    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有帐号?(注-册)加入51Testing

    x
    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏
    回复

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-11-11 00:05 , Processed in 0.065456 second(s), 24 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表