如何使用Python的海龟绘制哆啦梦

  介绍

这篇文章主要介绍了如何使用Python的海龟绘制哆啦梦,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获、下面让小编带着大家一起了解一下。

Python可以做什么

Python是一种编程语言,内置了许多有效的工具,Python几乎无所不能,该语言通俗易懂,容易入门,功能强大,在许多领域中都有广泛的应用,例如最热门的大数据分析,人工智能,网页开发等。

<强>画出来的效果如下图:

如何使用Python的海龟绘制哆啦梦

<强>代码如下:

#, *,,, utf-8 ——, *   #,作者:唐   ,   import  turtle  as  t   ,   t.speed (10)   t.pensize (8)   t.hideturtle ()   t.screensize (500,, 500,, bg=& # 39;白色# 39;)   ,   #,猫脸   t.fillcolor (& # 39; # 00 a1e8& # 39;)   t.begin_fill ()   t.circle (120)   t.end_fill ()   ,   t.pensize (3)   t.fillcolor(& # 39;白色# 39;)   t.begin_fill ()   t.circle (100)   t.end_fill ()   ,   t.pu ()   t.home ()   t.goto (0, 134)   t.pd ()   t.pensize (4)   t.fillcolor (“# EA0014")   t.begin_fill ()   t.circle (18)   t.end_fill ()   ,   t.pu ()   t.goto (7, 155)   t.pensize (2)   t.color(& # 39;白色# 39;,,& # 39;白色# 39;)   t.pd ()   t.begin_fill ()   t.circle (4)   t.end_fill ()   ,   t.pu ()   t.goto (-30,, 160)   t.pensize (4)   t.pd ()   t.color(& # 39;黑色# 39;,,& # 39;白色# 39;)   t.begin_fill ()   a  0.4=,   for 小姐:拷贝范围(120):   if 才能;0,& lt;=,小姐:& lt;, 30,趁机60,& lt;=,小姐:& lt;, 90:   ,,,a =, + 0.08   ,,,t.lt(3), #向左转3度   ,,,t.fd (a), #向前走一的步长   其他的才能:   ,,,=,a  0.08   ,,,t.lt (3)   ,,,t.fd (a)   t.end_fill ()   ,   t.pu ()   t.goto (30, 160)   t.pensize (4)   t.pd ()   t.color(& # 39;黑色# 39;,,& # 39;白色# 39;)   t.begin_fill ()   for 小姐:拷贝范围(120):   if 才能;0,& lt;=,小姐:& lt;, 30,趁机60,& lt;=,小姐:& lt;, 90:   ,,,a =, + 0.08   ,,,t.lt(3), #,向左转3度   ,,,t.fd (a), #,向前走一的步长   其他的才能:   ,,,=,a  0.08   ,,,t.lt (3)   ,,,t.fd (a)   t.end_fill ()   ,   t.pu ()   t.goto (-38190)   t.pensize (8)   t.pd ()   t.right (-30)   t.forward (15)   t.right (70)   t.forward (15)   ,   t.pu ()   t.goto (15, 185)   t.pensize (4)   t.pd ()   t.color(& # 39;黑色# 39;,,& # 39;黑色# 39;)   t.begin_fill ()   t.circle (13)   t.end_fill ()   ,   t.pu ()   t.goto (13, 190)   t.pensize (2)   t.pd ()   t.color(& # 39;白色# 39;,,& # 39;白色# 39;)   t.begin_fill ()   t.circle (5)   t.end_fill ()   ,   t.pu ()   t.home ()   t.goto (0, 134)   t.pensize (4)   t.pencolor(& # 39;黑色# 39;)   t.pd ()   t.right (90)   t.forward (40)   ,   t.pu ()   t.home ()   t.goto (0, 124)   t.pensize (3)   t.pencolor(& # 39;黑色# 39;)   t.pd ()   t.left (10)   t.forward (80)   ,   t.pu ()   t.home ()   t.goto (0, 114)   t.pensize (3)   t.pencolor(& # 39;黑色# 39;)   t.pd ()   t.left (6)   t.forward (80)   ,   t.pu ()   t.home ()   t.goto (0104)   t.pensize (3)   t.pencolor(& # 39;黑色# 39;)   t.pd ()   t.left (0)   t.forward (80)   ,   #,左边的胡子   t.pu ()   t.home ()   t.goto (0124)   t.pensize (3)   t.pencolor(& # 39;黑色# 39;)   t.pd ()   t.left (170)   t.forward (80)   ,   t.pu ()   t.home ()   t.goto (0, 114)   t.pensize (3)   t.pencolor(& # 39;黑色# 39;)   t.pd ()   t.left (174)   t.forward (80)   ,   t.pu ()   t.home ()   t.goto (0, 104)   t.pensize (3)   t.pencolor(& # 39;黑色# 39;)   t.pd ()   t.left (180)   t.forward (80)   ,   t.pu ()   t.goto (-70,, 70)   t.pd ()   t.color(& # 39;黑色# 39;,,& # 39;红色# 39;)   t.pensize (6)   t.seth (-60)   t.begin_fill ()   t.circle(80年,40)   t.circle (80、80)   t.end_fill ()   ,   t.pu ()   t.home ()   t.goto (-80、70)   t.pd ()   t.forward (160)   ,   t.pu ()   t.home ()   t.goto(-50年,50)   t.pd ()   t.pensize (1)   t.fillcolor (“# eb6e1a")   t.seth (40)   t.begin_fill ()   t.circle (-40, 40)   t.circle (-40, 40)   t.seth (40)   t.circle (-40, 40)   t.circle (-40, 40)   t.seth (220)   t.circle (-80, 40)   t.circle (-80, 40)   t.end_fill ()   ,   #,领带   t.pu ()   t.goto (-70, 12)   t.pensize (14)   t.pencolor(& # 39;红色# 39;)   t.pd ()   t.seth (-20)   t.circle (200, 30)   t.circle (200, 10)   ,   #,铃铛   t.pu ()   t.goto (0, -46)   t.pd ()   t.pensize (3)   t.color (“black", & # 39; # f8d102& # 39;)   t.begin_fill ()   t.circle (25)   t.end_fill ()   ,   ,   t.pu ()   t.goto (5, -40)   t.pd ()   t.pensize (2)   t.color (“black", & # 39; # 79675 d # 39;)   t.begin_fill ()   t.circle (5)   t.end_fill ()   ,   t.pensize (3)   t.right (115)   t.forward (7)   ,   t.mainloop ()

如何使用Python的海龟绘制哆啦梦