turtle练习
Posted 爱斯基摩人
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了turtle练习相关的知识,希望对你有一定的参考价值。
1同心圆
>>>import turtle
>>> turtle.circle(20)
>>> turtle.up()
>>> turtle.goto(0,10)
>>> turtle.goto(0,-10)
>>> turtle.circle (30)
>>> turtle.down()
>>> turtle.circle (30)
>>> turtle.up()
>>> turtle.goto(0,-20)
>>> turtle.down()
>>> turtle.circle (40)
>>> turtle.up()
>>> turtle.goto(0,-50)
>>> turtle.down()
>>> turtle.circle (40)
>>> turtle.up()
>>>turtle.down()
>>> turtle.circle (70)
2同切圆
>>>turtle.circle(40)
>>> turtle.circle(30)
>>> turtle.circle(50)
>>> turtle.shape(‘turtle‘)
3五角星
turtle.forward (100)
>>> turtle.right(144)
>>> turtle.forward (100)
>>> turtle.right(144)
>>> turtle.forward (100)
>>> turtle.right(144)
>>> turtle.forward (100)
>>> turtle.right(144)
4填色五角星
>>> turtle.color(‘yellow‘)
>>> turtle.fillcolor(‘yellow‘)
>>> turtle.bgcolor(‘red‘)
>>> turtle.begin_fill()
>>> turtle.forward (100)
>>> turtle.right(144)
>>> turtle.forward (100)
>>> turtle.right(144)
>>> turtle.forward (100)
>>> turtle.right(144)
>>> turtle.forward (100)
>>> turtle.right(144)
>>> turtle.forward (100)
>>> turtle.end_fill()
以上是关于turtle练习的主要内容,如果未能解决你的问题,请参考以下文章