zoukankan      html  css  js  c++  java
  • 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 
     20 def 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 
     39 def 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 
     50 def 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 
     89 def setting():
     90     t.pensize(4)
     91     t.hideturtle()
     92     t.setup(1000, 600)
     93     t.speed(10)
     94     t.screensize(bg='yellow')
     95 
     96 
     97 def 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()
    106 
    107 
    108 if __name__ == '__main__':
    109     main()

  • 相关阅读:
    用javascript写星际飞机大战游戏
    Vue源码分析之实现一个简易版的Vue
    Vue源码分析之数据驱动
    Vue源码分析之虚拟DOM
    使用HbuilderX离线打包5+APP
    ERROR in build.js from UglifyJs
    PHP 的一些开发规范
    Markdown使用TOC自动生成导航栏
    Hexo博客skapp主题部署填坑指南
    Docker 官方安装详解
  • 原文地址:https://www.cnblogs.com/liangxfng/p/11847697.html
Copyright © 2011-2022 走看看