turtle库基础练习

1、画一组同切圆

>>> import turtle
>>> turtle.circle(10)
>>> turtle.circle(20)
>>> turtle.circle(30)
>>> turtle.circle(40)

 

2、画一组同心圆

import turtle

turtle.hideturtle()

turtle.up()
turtle.goto(0,-10)
turtle.down()
turtle.circle(10)
turtle.up()
turtle.goto(0,-20)
turtle.down()
turtle.circle(20)
turtle.up()
turtle.goto(0,-30)
turtle.down()
turtle.circle(30)

 

3、画一个五角星

import turtle

turtle.forward(200)
turtle.right(144)
turtle.forward(200)
turtle.right(144)
turtle.forward(200)
turtle.right(144)
turtle.forward(200)
turtle.right(144)
turtle.forward(200)

 

4、画一个黄色实心五角星

import turtle

turtle.color('yellow')
turtle.fillcolor('yellow')

turtle.begin_fill()
turtle.forward(200)
turtle.right(144)
turtle.forward(200)
turtle.right(144)
turtle.forward(200)
turtle.right(144)
turtle.forward(200)
turtle.right(144)
turtle.forward(200)
turtle.end_fill()

turtle.hideturtle()

 

5、画左上角的五颗五角星

import turtle

turtle.speed(10)
turtle.color('yellow')
turtle.bgcolor('red')
turtle.fillcolor('yellow')

turtle.up()
turtle.goto(-300,150)
turtle.down()

turtle.begin_fill()
turtle.forward(120)
turtle.right(144)
turtle.forward(120)
turtle.right(144)
turtle.forward(120)
turtle.right(144)
turtle.forward(120)
turtle.right(144)
turtle.forward(120)
turtle.end_fill()

turtle.up()
turtle.goto(-80,230)
turtle.down()

turtle.begin_fill()
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.end_fill()

turtle.up()
turtle.goto(-75,200)
turtle.down()

turtle.begin_fill()
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.end_fill()

turtle.up()
turtle.goto(-80,80)
turtle.down()

turtle.begin_fill()
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.end_fill()

turtle.up()
turtle.goto(-90,40)
turtle.down()

turtle.begin_fill()
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.right(144)
turtle.forward(50)
turtle.end_fill()

 

转载于:https://www.cnblogs.com/lyx1997/p/7509614.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值