使用python的turtle库画一个冰墩墩

目录

先看效果图

设置一个画布

点击查看代码
import turtle
turtle.setup(800,600)
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()

画头部彩虹

点击查看代码
turtle.penup()
turtle.goto(-135, 120)
turtle.pensize(5)
turtle.pencolor("cyan")
turtle.pendown()
turtle.setheading(60)
turtle.circle(-165, 150)
turtle.circle(-130, 78)
turtle.circle(-250, 30)
turtle.circle(-138, 105)
turtle.penup()
turtle.goto(-131, 116)
turtle.pencolor("slateblue")
turtle.pendown()
turtle.setheading(60)
turtle.circle(-160, 144)
turtle.circle(-120, 78)
turtle.circle(-242, 30)
turtle.circle(-135, 105)
turtle.penup()
turtle.goto(-127, 112)
turtle.pencolor("orangered")
turtle.pendown()
turtle.setheading(60)
turtle.circle(-155, 136)
turtle.circle(-116, 86)
turtle.circle(-220, 30)
turtle.circle(-134, 103)
turtle.penup()
turtle.goto(-123, 108)
turtle.pencolor("gold")
turtle.pendown()
turtle.setheading(60)
turtle.circle(-150, 136)
turtle.circle(-104, 86)
turtle.circle(-220, 30)
turtle.circle(-126, 102)
turtle.penup()
turtle.goto(-120, 104)
turtle.pencolor("greenyellow")
turtle.pendown()
turtle.setheading(60)
turtle.circle(-145, 136)
turtle.circle(-90, 83)
turtle.circle(-220, 30)
turtle.circle(-120, 100)
turtle.penup()

画五环标志

点击查看代码
turtle.penup()
turtle.goto(-5, -170)
turtle.pensize(1)
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()

turtle.pencolor("black")
turtle.goto(-16, -160)
turtle.write("BEIJING 2022", font=('Arial', 10, 'bold italic'))
turtle.hideturtle()

最后(别忘记还有一个结束)

turtle.done()

推荐这些文章:

冰墩墩python代码

import turtle

turtle.title('Python(冰墩墩,情人节特别版本)')
turtle.speed(40) # 可以自己调节速度
# 左手
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.circ...

买不到冰墩墩?用python画一个吧,人人都有喔

大家好 !
这两天,随着北京冬奥会的开幕,吉祥物“冰墩墩”可是火出了圈,多少人排长队都买不到。据说甚至有人把价格炒到了几千元。
为了帮助大家早日实现“一户一墩”,Crossin连夜加班,肝出了这个:
Python版冰墩墩
话不多说,直接上效果。
效果图:

说实话,这个没什么技术含量,就是硬“肝”,不断调整曲线细节。
用的是 Python 自带的 turtle 库。
说个用 turtle 画图的小技巧:你可以通过
turtle.bgpic(r'bg.png')

这个语句把你要参考的图先绘制在窗口中,然后再对照着进行绘制调整,就方便许多了。
废话不多说直接上源码:
import turtle...

【黄啊码】教你用python画冰墩墩

import turtle

turtle.title('PythonBingDwenDwen(视频号:黄啊码)')

turtle.speed(100) # 速度

# 左手
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(...

RunDunDun---python

代码如下
import turtle

turtle.title('PythonBingDwenDwen')

# 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...

海龟绘图;冰墩墩;turtle; python

import turtle
turtle.title('PythonBingDwenDwen')
turtle.speed(200) # 速度
# 左手
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)
tur...

python 画冰墩墩 海龟绘图turtle绘制 没啥 技术含量就是不断的调整弧度

import turtle
turtle.title('PythonBingDwenDwen')
turtle.speed(200) # 速度
# 左手
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)
tur...

python画冰墩墩

今天已经到了2022北京冬奥闭幕的日子,然而我还没有属于自己的冰墩墩😭
所以,赶紧来画一个吧

import turtle as t

t.Screen().title('冰墩墩') # 窗口标题
t.speed(0) # 画笔速度-最快0~10

# 头顶
t.penup()
t.goto(-73, 230)
t.pencolor("lightgray")
t.pensize(3)
t.fillcolor("white")
t.begin_fill()
t.pendown()
t.setheading(20)
t.circle(-250, 35)
# 左耳
t.setheading(5...

python 手绘 冰墩墩(源码附上)

import turtle

turtle.title('PythonBingDwenDwen')

turtle.speed(100) # 速度

# 左手
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)
t...

python画图画字-turtle

Turtle库是Python语言中一个很流行的绘制图像的函数库
使用之前需要导入库:import turtle
turtle绘图的基础知识:
1.设置画布窗口
turtle.setup(width,height,startx,starty)
  -setup() 设置窗体的位置和大小
  相对于桌面的起始点的坐标以及窗口的宽度高度,若不写窗口的起始点,则默认在桌面的正中心
  窗体的坐标原点默认在窗口的中心
2.绝对坐标
  ○ turtle.goto(100,100):指从当前的点指向括号内所给坐标
3.海龟坐标,把当前点当做坐标,有前方向,后方向,左方向,右方向
turtle.fd(d)...

python turtle 各种示例

 
pensize() 函数的示例

import turtle
step=100
turtle.penup()
turtle.setposition(-400, 0)
turtle.pendown()
turtle.speed(1)
turtle.write(0.001)
turtle.pensize(0.001)
turtle.forward(step)
turtle.write(0.01)
turtle.pensize(0.01)
turtle.forward(step)
turtle.write(0.01)
turtle.pensize(0.1)
turtle.forwar...

文章标题:使用python的turtle库画一个冰墩墩
文章链接:https://www.dianjilingqu.com/50917.html
本文章来源于网络,版权归原作者所有,如果本站文章侵犯了您的权益,请联系我们删除,联系邮箱:saisai#email.cn,感谢支持理解。
THE END
< <上一篇
下一篇>>