时间:2021-05-22
我就废话不多说了,直接上代码吧!
import turtlet=turtle.Turtle()turtle.Turtle().screen.delay(0)tleft=turtle.Turtle()#第一部分t.penup()t.goto(0,0)t.pendown()t.left(20)t.forward(110)t.left(25)t.forward(40)t.left(100)t.circle(180,20)t.right(120)t.forward(250)t.left(165)t.forward(250)t.right(100)t.forward(35)t.left(70)t.forward(45)t.left(70)t.forward(120)t.left(70)t.forward(80)t.left(80)t.forward(80)t.left(68)t.forward(120)t.left(180)t.forward(78)t.right(68)t.forward(60)t.right(75)t.forward(60)t.right(110)t.forward(15)t.left(38)t.forward(65)t.right(73)#五边形的直边t.forward(35)t.right(70)t.forward(65)t.right(68)t.forward(50)t.right(80)t.forward(50)t.penup()t.goto(-65,68)t.pendown()t.right(7)t.forward(350)t.right(165)t.forward(330)t.penup()t.goto(64,65)t.pendown()t.left(75)t.forward(350)t.left(165)t.forward(330)t.penup()t.goto(300,500)#第二部分tleft.left(180)tleft.right(20)tleft.forward(110)tleft.right(25)tleft.forward(40)tleft.right(100)tleft.circle(-180,20)tleft.left(120)tleft.forward(250)tleft.right(165)tleft.forward(250)tleft.left(100)tleft.forward(35)tleft.penup()tleft.goto(0,0)tleft.pendown()tleft.left(20)tleft.penup()tleft.forward(18)tleft.pendown()tleft.forward(50)#额头竖线tleft.penup()tleft.forward(110)#消除竖线tleft.pendown()tleft.left(90)tleft.forward(30)tleft.right(90)tleft.forward(60)tleft.right(90)tleft.forward(60)tleft.right(90)tleft.forward(60)tleft.right(90)tleft.forward(40)tleft.penup()tleft.forward(30)tleft.pendown()tleft.left(90)tleft.forward(30)tleft.right(180)tleft.forward(100)tleft.right(90)tleft.forward(80)tleft.right(90)tleft.forward(100)tleft.penup()tleft.goto(150,70)tleft.pendown()tleft.left(100)tleft.forward(40)tleft.right(80)tleft.circle(-333,40)tleft.right(160)tleft.forward(230)#右半部分tleft.left(100)tleft.forward(40)tleft.left(80)tleft.forward(20)tleft.left(100)tleft.forward(30)tleft.right(100)tleft.forward(20)tleft.right(80)tleft.forward(30)tleft.left(80)tleft.forward(20)tleft.left(100)tleft.forward(30)tleft.right(100)tleft.forward(20)tleft.right(80)tleft.forward(30)tleft.left(80)tleft.forward(20)tleft.left(100)tleft.forward(30)tleft.right(100)tleft.forward(20)tleft.right(80)tleft.forward(30)tleft.left(80)tleft.forward(20)tleft.left(100)tleft.forward(30)tleft.right(100)tleft.forward(20)tleft.right(80)tleft.forward(30)tleft.left(80)tleft.forward(20)tleft.left(100)tleft.forward(30)tleft.right(100)tleft.forward(20)tleft.right(80)tleft.forward(30)tleft.left(80)tleft.forward(20)tleft.left(100)tleft.forward(30)tleft.right(100)tleft.forward(20)tleft.right(80)tleft.forward(30)#右下部分tleft.left(70)tleft.forward(30)tleft.right(110)tleft.forward(40)tleft.right(60)tleft.forward(100)tleft.right(30)tleft.circle(200,20)tleft.left(10)tleft.forward(80)#右下部分gototleft.penup()tleft.goto(145,-198)tleft.pendown()tleft.left(90)tleft.forward(30)tleft.right(30)tleft.forward(40)tleft.right(150)tleft.forward(30)tleft.backward(30)tleft.left(90)tleft.forward(100)tleft.right(90)tleft.forward(30)tleft.backward(30)tleft.left(90)tleft.right(30)tleft.circle(200,20)tleft.left(10)tleft.forward(50)#第三部分脸t2=turtle.Turtle()t2.penup()t2.goto(0,-80)#尖角t2.circle(150,extent=90)t2.pendown()t2.circle(150,extent=30)t2.penup()t2.circle(150,extent=18)t2.pendown()t2.circle(150,extent=27)t2.penup()t2.circle(150,extent=30)t2.pendown()t2.circle(150,extent=27)t2.penup()t2.circle(150,extent=18)t2.pendown()t2.circle(150,extent=30)t2.right(100)t2.forward(40)#左脸夹t2.left(80)t2.circle(333,40)t2.left(160)t2.forward(230)#左半部分t2.right(100)t2.forward(40)t2.right(80)t2.forward(20)t2.right(100)t2.forward(30)t2.left(100)t2.forward(20)t2.left(80)t2.forward(30)t2.right(80)t2.forward(20)t2.right(100)t2.forward(30)t2.left(100)t2.forward(20)t2.left(80)t2.forward(30)t2.right(80)t2.forward(20)t2.right(100)t2.forward(30)t2.left(100)t2.forward(20)t2.left(80)t2.forward(30)t2.right(80)t2.forward(20)t2.right(100)t2.forward(30)t2.left(100)t2.forward(20)t2.left(80)t2.forward(30)t2.right(80)t2.forward(20)t2.right(100)t2.forward(30)t2.left(100)t2.forward(20)t2.left(80)t2.forward(30)t2.right(80)t2.forward(20)t2.right(100)t2.forward(30)t2.left(100)t2.forward(20)t2.left(80)t2.forward(30)t2.right(70)t2.forward(30)t2.left(110)t2.forward(40)t2.left(60)t2.forward(100)t2.left(30)t2.circle(-200,20)t2.right(10)t2.forward(80)t2.penup()t2.goto(-145,-198)#左脸颊t2.pendown()t2.right(90)t2.forward(30)t2.left(30)t2.forward(40)t2.left(150)t2.forward(30)t2.right(180)t2.forward(30)t2.left(90)t2.forward(100)t2.left(90)t2.forward(30)t2.left(180)t2.forward(30)t2.left(120)t2.circle(-200,20)t2.right(10)t2.forward(50)#左眼t2.right(135)t2.forward(70)t2.left(50)t2.forward(40)t2.left(20)t2.forward(20)t2.penup()t2.goto(-100,28)t2.pendown()t2.right(70)t2.forward(65)t2.left(50)t2.forward(40)t2.left(40)t2.forward(20)#左眼带t2.penup()t2.goto(-105,-10)t2.pendown()t2.right(100)t2.circle(120,extent=20)t2.circle(60,extent=80)t2.penup()t2.goto(-105,-13)t2.pendown()t2.right(100)t2.circle(120,extent=20)t2.circle(60,extent=80)t2.penup()t2.goto(-70,-40)t2.pendown()t2.left(10)t2.forward(30)t2.penup()t2.goto(-10,-40)t2.pendown()t2.left(35)t2.forward(30)t2.penup()t2.goto(-80,30)t2.pendown()t2.right(130)t2.forward(47)t2.left(50)t2.forward(35)t2.penup()t2.goto(-60,-45)t2.pendown()t2.right(98)t2.forward(60)t2.left(20)t2.forward(80)t2.left(70)t2.forward(10)t2.left(90)t2.forward(50)t2.right(60)t2.forward(30)t2.right(60)t2.forward(30)t2.right(60)t2.forward(50)t2.left(90)t2.forward(10)t2.left(75)t2.forward(80)t2.left(15)t2.forward(60)t2.penup()t2.goto(-80,-140)t2.pendown()t2.right(150)t2.circle(85,extent=45)t2.left(15)t2.forward(70)t2.left(15)t2.circle(55,extent=55)t2.penup()t2.goto(0,-175)t2.pendown()t2.left(18)t2.forward(170)#右眼tleft.left(135)tleft.forward(70)tleft.right(50)tleft.forward(40)tleft.right(20)tleft.forward(20)tleft.penup()tleft.goto(100,28)tleft.pendown()tleft.left(70)tleft.forward(65)tleft.right(50)tleft.forward(40)tleft.right(40)tleft.forward(20)#右眼带tleft.penup()tleft.goto(105,-10)tleft.pendown()tleft.left(100)tleft.circle(-120,extent=20)tleft.circle(-60,extent=80)tleft.penup()tleft.goto(105,-13)tleft.pendown()tleft.left(100)tleft.circle(-120,extent=20)tleft.circle(-60,extent=80)#右眼睛tleft.penup()tleft.goto(70,-40)tleft.pendown()tleft.right(10)tleft.forward(30)tleft.penup()tleft.goto(10,-40)tleft.pendown()tleft.right(35)tleft.forward(30)tleft.penup()tleft.goto(80,30)tleft.pendown()tleft.left(130)tleft.forward(47)tleft.right(50)tleft.forward(35)#鼻子tleft.penup()tleft.goto(0,-70)tleft.pendown()tleft.left(30)tleft.forward(20)tleft.left(72)tleft.forward(10)tleft.left(108)tleft.forward(20)tleft.right(42)tleft.forward(20)tleft.left(108)tleft.forward(10)tleft.left(72)tleft.forward(20)tleft.penup()tleft.goto(0,-90)tleft.pendown()tleft.left(42)tleft.forward(20)tleft.left(72)tleft.forward(10)tleft.left(108)tleft.forward(20)tleft.right(42)tleft.forward(20)tleft.left(108)tleft.forward(10)tleft.left(72)tleft.forward(20)tleft.penup()tleft.goto(200,500)turtle.done()以上这篇使用python turtle画高达就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
turtle模块turtle模块:python内置的绘图工具turtle(海龟)模块,我们是用它来进行画图的,基本上就是画简单的直线,点,和曲线。你可以把它想成
本文实例为大家分享了python使用turtle画国际象棋棋盘的具体代码,供大家参考,具体内容如下使用的方法是每一个小格每一个小格的画importturtlef
这是我几年前为了练习python的turtle库而画的,今天翻出了代码,分享给大家。这是我初学python时画的,当时还没有面向对象的概念,也没有采取类方法之类
python的turtle库的简单使用Python的turtle库是一个直观有趣的图形绘制函数库,是python的标准库之一。一、绘图坐标体系turtle库绘制
本文实例主要是对turtle的使用,实现Python+turtle动态绘制一棵树的实例,具体代码:#drawtree.pyfromturtleimportTur