turtle-'一箭穿心',猿类的爱情
Posted yueshangxigelou
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了turtle-'一箭穿心',猿类的爱情相关的知识,希望对你有一定的参考价值。
基于python2.7。
1 #coding:utf-8 2 import turtle 3 4 def curvemove():#定义函数画圆,200度 5 for i in range(100): 6 turtle.right(2) 7 turtle.forward(2) 8 turtle.speed(8) 9 10 turtle.color(‘red‘,(‘#F05B72‘))#设置画笔及填充颜色 11 turtle.pensize(3) 12 turtle.hideturtle()#隐藏画笔形状 13 turtle.speed(5) 14 turtle.begin_fill()#开始填充 15 16 turtle.left(140) 17 turtle.forward(111.65) 18 curvemove() 19 turtle.left(120) 20 curvemove() 21 turtle.forward(111.65) 22 turtle.end_fill() 23 24 turtle.color((‘#F05B72‘),‘red‘) 25 turtle.begin_fill() 26 turtle.penup() 27 turtle.goto(60,0) 28 turtle.pendown() 29 turtle.right(80) 30 turtle.forward(111.65) 31 curvemove() 32 turtle.left(120) 33 curvemove() 34 turtle.forward(111.65) 35 turtle.end_fill() 36 37 turtle.color(‘red‘,‘red‘) 38 turtle.begin_fill() 39 turtle.hideturtle() 40 turtle.penup() 41 turtle.goto(-150,20) 42 turtle.pendown() 43 turtle.pensize(5) 44 turtle.right(20) 45 turtle.right(60) 46 turtle.forward(15) 47 turtle.right(120) 48 turtle.forward(40) 49 turtle.right(60) 50 turtle.forward(14) 51 turtle.left(60) 52 turtle.forward(375) 53 turtle.left(90) 54 turtle.forward(10) 55 turtle.right(110) 56 turtle.forward(30) 57 turtle.right(140) 58 turtle.forward(30) 59 turtle.right(110) 60 turtle.forward(10) 61 turtle.left(90) 62 turtle.forward(375) 63 turtle.left(60) 64 turtle.forward(14) 65 turtle.right(60) 66 turtle.forward(40) 67 turtle.right(120) 68 turtle.forward(15) 69 turtle.end_fill() 70 71 turtle.penup() 72 turtle.goto(10.5,85) 73 turtle.color("violet") 74 turtle.write("L O V E", font=(‘Dutch801 XBd BT‘, 20, ‘normal‘)) 75 76 turtle.done()
最后效果图:
遗憾:未能有效移除‘笔迹‘。
以上是关于turtle-'一箭穿心',猿类的爱情的主要内容,如果未能解决你的问题,请参考以下文章
关于报错:AttributeError: module 'turtle' has no attribute 'setup' 问题