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

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

  1. 画一组同切圆
    import turtleturtle.shape('turtle')turtle.circle(10)turtle.circle(20)turtle.circle(30)turtle.circle(40)turtle.circle(50)turtle.circle(60)turtle.circle(70)turtle.circle(80)turtle.hideturtle()
    turtle.done()

     

  2. 画一组同心圆

    import turtleturtle.shape('turtle')turtle.circle(20)turtle.up()turtle.goto(0,-20)turtle.down()turtle.circle(40)turtle.up()turtle.goto(0,-40)turtle.down()turtle.circle(60)turtle.up()turtle.goto(0,-60)turtle.down()turtle.circle(80)turtle.up()turtle.goto(0,-80)turtle.down()turtle.circle(100)turtle.up()turtle.goto(0,-100)turtle.down()turtle.circle(120)turtle.up()turtle.goto(0,-120)turtle.down()turtle.circle(140)turtle.up()turtle.goto(0,-140)turtle.down()turtle.circle(160)turtle.hideturtle()
    turtle.done()

     

  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)turtle.hideturtle()
    turtle.done()

     

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

    import turtleturtle.shape('turtle')turtle.color('yellow')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() turtle.done()

  5. 画左上角的五颗五角星
    import turtleturtle.shape('turtle')turtle.bgcolor('red')turtle.color('yellow')turtle.fillcolor('yellow')turtle.up()turtle.goto(-330,170)turtle.down() turtle.begin_fill()turtle.forward(150)turtle.right(144)turtle.forward(150)turtle.right(144)turtle.forward(150)turtle.right(144)turtle.forward(150)turtle.right(144)turtle.forward(150)turtle.end_fill()turtle.up()turtle.goto(-130,220)turtle.down() turtle.begin_fill()turtle.forward(40)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,200)turtle.down() turtle.begin_fill()turtle.forward(40)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,130)turtle.down() turtle.begin_fill()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.right(144)turtle.forward(50)turtle.end_fill()turtle.up()turtle.goto(-130,30)turtle.down() turtle.begin_fill()turtle.forward(40)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.hideturtle()
    turtle.done()

     

转载于:https://www.cnblogs.com/qisq/p/7509323.html

你可能感兴趣的文章
HDU(4528),BFS,2013腾讯编程马拉松初赛第五场(3月25日)
查看>>
vim中文帮助教程
查看>>
MySQL基础3
查看>>
RxJS & Angular
查看>>
面向对象(多异常的声明与处理)
查看>>
MTK笔记
查看>>
ERROR: duplicate key value violates unique constraint "xxx"
查看>>
激活office 365 的启动文件
查看>>
无法根据中文查找
查看>>
[简讯]phpMyAdmin项目已迁移至GitHub
查看>>
转载 python多重继承C3算法
查看>>
【题解】 bzoj1597: [Usaco2008 Mar]土地购买 (动态规划+斜率优化)
查看>>
css文本溢出显示省略号
查看>>
git安装和简单配置
查看>>
面向对象:反射,双下方法
查看>>
鼠标悬停提示文本消息最简单的做法
查看>>
课后作业-阅读任务-阅读提问-2
查看>>
面向对象设计中private,public,protected的访问控制原则及静态代码块的初始化顺序...
查看>>
fat32转ntfs ,Win7系统提示对于目标文件系统文件过大解决教程
查看>>
Awesome Adb——一份超全超详细的 ADB 用法大全
查看>>