当前位置:首页 > Python教程 > python技巧

100行python语言简单画一个皮卡丘

效果图请拉到底!

              1
            import
             turtle as t

              2
              3
              4
            def
             nose():

              5
                t.penup()

              6     t.seth(90)
  7     t.fd(100)
  8    t.pendown()
  9    t.begin_fill()
 10     t.fillcolor(black)
 11     t.seth(45)
 12     t.fd(25)
 13     t.seth(135)
 14     t.circle(25, 90)
 15     t.seth(315)
 16     t.fd(25)
 17    t.end_fill()
 18 19 20def eyes(seth, fd, c):
 21    t.penup()
 22    t.seth(seth)
 23    t.fd(fd)
 24    t.pendown()
 25    t.begin_fill()
 26     t.fillcolor(black)
 27     t.circle(50)
 28    t.end_fill()
 29 30    t.penup()
 31     t.circle(50, c)
 32    t.pendown()
 33    t.begin_fill()
 34     t.fillcolor(white)
 35     t.circle(20)
 36    t.end_fill()
 37 38 39def face(seth, fd):
 40    t.penup()
 41    t.seth(seth)
 42    t.fd(fd)
 43    t.pendown()
 44    t.begin_fill()
 45     t.fillcolor(red)
 46     t.circle(70)
 47    t.end_fill()
 48 49 50def lip():
 51    t.penup()
 52     t.seth(135)
 53     t.fd(250)
 54    t.pendown()
 55     t.seth(-300)
 56     t.circle(30, -65)
 57    t.begin_fill()
 58     t.fillcolor(Firebrick)
 59     t.seth(165)
 60     t.fd(140)
 61     t.seth(195)
 62     t.fd(140)
 63     t.seth(-360)
 64     t.circle(30, -65)
 65    t.penup()
 66     t.seth(-60)
 67     t.circle(30, 65)
 68    t.pendown()
 69     t.seth(-70)
 70     t.fd(240)
 71     t.circle(55, 140)
 72     t.seth(70)
 73     t.fd(240)
 74    t.end_fill()
 75     t.seth(-110)
 76     t.fd(80)
 77    t.begin_fill()
 78     t.fillcolor(Firebrick1)
 79     t.seth(120)
 80     t.circle(120, 123)
 81     t.seth(-70)
 82     t.fd(165)
 83     t.circle(55, 140)
 84     t.seth(72)
 85     t.fd(165)
 86    t.end_fill()
 87 88 89def setting():
 90     t.pensize(4)
 91    t.hideturtle()
 92     t.setup(1000, 600)
 93     t.speed(10)
 94     t.screensize(bg=yellow)
 95 96 97def main():
 98    setting()
 99    nose()
100     eyes(160, 250, 60)
101     eyes(-9.5, 530, 230)
102     face(195, 600)
103     face(-11, 720)
104    lip()
105    t.done()
106107108if__name__ == __main__:
109     main()

技术分享图片

 

原文:https://www.cnblogs.com/liangxfng/p/11847697.html


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!

相关教程推荐

其他课程推荐