猫史档案馆


【回答】如何用代码画出小猪佩奇@栗子安安

用户:风少年风少年查看:0 回复:2 评论:0 创建时间:2019-01-22T21:51:41


今天我看到你发的帖子https://www.codemao.cn/community/171973

刚好我也研究了一下,好像也有人回复你了

但不管啦。。

先看下我的效果

center_image

center_image

 

这是部分代码,有点多就不一一写上去了,如有需要可以联系我

from turtle import*

def nose(x,y):#鼻子
    penup()#提起笔
    goto(x,y)#定位
    pendown()#落笔,开始画
    setheading(-30)#将乌龟的方向设置为to_angle/为数字(0-东、90-北、180-西、270-南)
    begin_fill()#准备开始填充图形
    a=0.4
    for i in range(120):
        if 0<=i<30 or 60<=i<90:
            a=a+0.08
            left(3) #向左转3度
            forward(a) #向前走a的步长
        else:
            a=a-0.08
            left(3)
            forward(a)
    end_fill()#填充完成

    penup()
    setheading(90)
    forward(25)
    setheading(0)
    forward(10)
    pendown()
    pencolor(255,155,192)#画笔颜色
    setheading(10)
    begin_fill()
    circle(5)
    color(160,82,45)#返回或设置pencolor和fillcolor
    end_fill()

    penup()
    setheading(0)
    forward(20)
    pendown()
    pencolor(255,155,192)
    setheading(10)
    begin_fill()
    circle(5)
    color(160,82,45)
    end_fill()


回复

上一页1 页 / 共 1下一页
魔术喵魔术喵

社会社会

用Python画小猪佩奇厉害了

emotion_编程猫_点赞

点赞0


评论


家灵cAZd家灵cAZd

来考古了,今天来到了2019-01-22

点赞0


评论