博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
turtle库基础练习
阅读量:4558 次
发布时间:2019-06-08

本文共 2624 字,大约阅读时间需要 8 分钟。

  1. 画一组同切圆
    import turtleturtle.shape("turtle")turtle.circle(50)turtle.circle(100)turtle.circle(150)

     

  2. 画一组同心圆
    import turtleturtle.shape("turtle")turtle.pos()turtle.circle(50)turtle.up()turtle.goto(0,-50)turtle.down()turtle.circle(100)turtle.up()turtle.goto(0,-100)turtle.down()turtle.circle(150)turtle.up()turtle.goto(0,-150)turtle.down()turtle.circle(200)

     

  3. 画一个五角星
    import turtleturtle.shape("turtle")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)

     

  4. 画一个黄色实心五角星
    import turtleturtle.shape("turtle")turtle.color("yellow")turtle.bgcolor("red")turtle.fillcolor("yellow")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.hideturtle()

     

  5. 画左上角的五颗五角星
    import turtleturtle.shape("turtle")turtle.color("yellow")turtle.bgcolor("red")turtle.fillcolor("yellow")turtle.begin_fill()turtle.up()turtle.goto(-270,170)turtle.down()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.hideturtle()turtle.color("yellow")turtle.bgcolor("red")turtle.fillcolor("yellow")turtle.begin_fill()turtle.up()turtle.goto(-130,170)turtle.down()turtle.forward(30)turtle.right(144)turtle.forward(30)turtle.right(144)turtle.forward(30)turtle.right(144)turtle.forward(30)turtle.right(144)turtle.forward(30)turtle.end_fill()turtle.hideturtle()turtle.color("yellow")turtle.bgcolor("red")turtle.fillcolor("yellow")turtle.begin_fill()turtle.up()turtle.goto(-120,160)turtle.down()turtle.forward(30)turtle.right(144)turtle.forward(30)turtle.right(144)turtle.forward(30)turtle.right(144)turtle.forward(30)turtle.right(144)turtle.forward(30)turtle.end_fill()turtle.hideturtle()turtle.color("yellow")turtle.bgcolor("red")turtle.fillcolor("yellow")turtle.begin_fill()turtle.up()turtle.goto(-160,100)turtle.down()turtle.forward(30)turtle.right(144)turtle.forward(30)turtle.right(144)turtle.forward(30)turtle.right(144)turtle.forward(30)turtle.right(144)turtle.forward(30)turtle.end_fill()turtle.hideturtle()turtle.color("yellow")turtle.bgcolor("red")turtle.fillcolor("yellow")turtle.begin_fill()turtle.up()turtle.goto(-155,200)turtle.down()turtle.forward(30)turtle.right(144)turtle.forward(30)turtle.right(144)turtle.forward(30)turtle.right(144)turtle.forward(30)turtle.right(144)turtle.forward(30)turtle.end_fill()turtle.hideturtle()

转载于:https://www.cnblogs.com/wk15/p/7509196.html

你可能感兴趣的文章
Android源码分析:Telephony部分–phone进程
查看>>
关于 redis.properties配置文件及rule
查看>>
WebService
查看>>
关于Java中重载的若干问题
查看>>
Java中start和run方法的区别
查看>>
二叉树_非递归先中后序_递归非递归求深度
查看>>
20181227 新的目标
查看>>
HDFS写流程
查看>>
生产环境服务器环境搭建+ 项目发布
查看>>
js按条件分类json数组,并合计同组数据(一维转换为二维)
查看>>
Exp6 信息搜集与漏洞扫描
查看>>
redis4安装
查看>>
使用命令wsimport构建WebService客户端[转]
查看>>
第八遍:链接详解
查看>>
Qt5.5 使用smtp发邮件的各种坑
查看>>
js奇葩错误 字符串传递问题
查看>>
人之初,性本恶
查看>>
springboot 端口号
查看>>
使用AChartEngine画动态曲线图
查看>>
安卓项目五子棋代码详解(四)
查看>>