当我学会了python,小黄人是这样画的。

终于成功!
颜色调的差强人意吧。
完整版
再放一下进化史。。
一张不成熟的小黄人。。。
当然,它也是会进化的。
正常亿点的小黄人
not good enough, try again.
最顺眼的一张
perfect

本人初学,非常不成熟的代码如下。

from turtle import *

def change(x,y):
    penup()
    goto(x,y)
    pendown()

pensize(7)

#body
begin_fill()
fillcolor('yellow')
change(0,100)
left(180)
circle(100,90)
forward(200)
circle(60,90)
forward(40)
#copybody
change(0,100)
right(180)
circle(100,-90)
forward(-200)
circle(60,-90)
forward(-40)
end_fill()

#eye
begin_fill()
fillcolor('white')
change(-28,-34)
circle(40)
end_fill()
begin_fill()
fillcolor('black')
change(-28,-8)
circle(13)
end_fill()
#copyeye
begin_fill()
fillcolor('white')
change(56,-34)
circle(40)
end_fill()
begin_fill()
fillcolor('black')
change(56,-8)
circle(13)
end_fill()

#glasses
begin_fill()
fillcolor('black')
change(-98,0)
forward(31)
left(90)
pensize(2)
forward(10)
left(90)
pensize(7)
forward(31)
left(90)
pensize(2)
forward(10)
pensize(7)
end_fill()

#cloth
begin_fill()
fillcolor('deep sky blue4')
change(-100,-200)
setheading(0)
forward(30)
left(90)
forward(75)
right(90)
forward(140)
right(90)
forward(75)
left(90)
forward(30)
left(90)
circle(60,-90)
forward(-80)
circle(60,-90)
end_fill()
#suspenders
begin_fill()
fillcolor('deep sky blue4')
change(-100,-125)
goto(-50,-150)
left(180)
forward(25)
left(90)
goto(-100,-100)
left(90)
forward(25)
end_fill()
change(-60,-130)
circle(-2)
#copysuspenders
begin_fill()
fillcolor('deep sky blue4')
change(100,-125)
setheading(180)
goto(50,-150)
right(90)
forward(25)
goto(100,-100)
right(180)
forward(25)
end_fill()
change(60,-130)
circle(2)

#pocket
change(30,-150)
setheading(180)
forward(60)
left(90)
forward(25)
circle(30,180)
forward(25)

#foot
begin_fill()
fillcolor('black')
change(-30,-260)
setheading(270)
forward(21)
right(90)
forward(11)
circle(10,180)
forward(36)
left(90)
forward(41)
left(90)
forward(25)
end_fill()
#copyfoot
begin_fill()
fillcolor('black')
change(30,-260)
setheading(90)
forward(-21)
left(90)
forward(-11)
circle(10,-180)
forward(-36)
right(90)
forward(-41)
left(90)
forward(-25)
end_fill()

#hand
begin_fill()
fillcolor('yellow')
change(-100,-125)
setheading(215)
circle(80,35)
left(70)
circle(100,20)
goto(-100,-164)
setheading(180)
circle(-7,180)
goto(-100,-125)
end_fill()
#copyhand
begin_fill()
fillcolor('yellow')
change(100,-125)
setheading(145)
circle(80,-35)
right(70)
circle(100,-20)
goto(100,-164)
setheading(180)
circle(-7,-180)
goto(100,-125)
end_fill()

#mouse
begin_fill()
fillcolor('white')
change(-10,-80)
setheading(0)
circle(150,30)
change(-10,-80)
setheading(330)
circle(130,21)
setheading(35)
circle(130,21)
goto(-10,-80)
end_fill()

#hair
change(-6,100)
setheading(135)
circle(50,75)
change(-6,100)
setheading(160)
circle(80,45)
change(0,102)
setheading(205)
circle(90,-48)
change(0,102)
setheading(186)
circle(175,-22)

hideturtle()
exitonclick()

期待更简洁;
感谢观看!

当然可以使用Python画小黄人!下面是一个简单的示例代码: ```python import turtle # 设置布和笔 canvas = turtle.Screen() canvas.bgcolor("white") pen = turtle.Turtle() # 身体 pen.penup() pen.goto(0, -100) pen.pendown() pen.begin_fill() pen.color("#FFD700") pen.circle(100) pen.end_fill() # 眼睛 pen.penup() pen.goto(-40, 20) pen.pendown() pen.begin_fill() pen.color("white") pen.circle(20) pen.end_fill() pen.penup() pen.goto(40, 20) pen.pendown() pen.begin_fill() pen.color("white") pen.circle(20) pen.end_fill() # 眼珠子 pen.penup() pen.goto(-30, 40) pen.pendown() pen.begin_fill() pen.color("black") pen.circle(7) pen.end_fill() pen.penup() pen.goto(50, 40) pen.pendown() pen.begin_fill() pen.color("black") pen.circle(7) pen.end_fill() # 嘴巴 pen.penup() pen.goto(-40, -10) pen.pendown() pen.color("black") pen.width(4) pen.setheading(-60) pen.circle(80, 120) # 背带 pen.penup() pen.goto(-70, -80) pen.pendown() pen.color("#FFD700") pen.begin_fill() for _ in range(2): pen.forward(140) pen.left(90) pen.forward(30) pen.left(90) pen.end_fill() # 脚 pen.penup() pen.goto(-50, -180) pen.pendown() pen.color("#FFD700") pen.begin_fill() for _ in range(2): pen.forward(100) pen.right(90) pen.forward(30) pen.right(90) pen.end_fill() # 完成 pen.hideturtle() canvas.exitonclick() ``` 运行上述代码,你将看到一个简单的小黄人图像绘制在布上。你也可以根据自己的需求对代码进行修改和扩展,加入更多细节和特色。享受绘画小黄人的乐趣吧!
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Stickic

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值