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

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

  1. 画一组同切圆
    import turtleturtle.circle(20)turtle.circle(40)turtle.circle(60)turtle.circle(80)turtle.done()

     

  2. 画一组同心圆
    import turtleturtle.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.done()

     

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

     

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

     

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

     

转载于:https://www.cnblogs.com/1996liuda/p/7509608.html

你可能感兴趣的文章
Git:配置
查看>>
神经系统知识普及
查看>>
Spring可扩展Schema标签
查看>>
c++ STL unique , unique_copy函数
查看>>
http://miicaa.yopwork.com/help/overall/
查看>>
浅谈关于特征选择算法与Relief的实现
查看>>
mybatis-spring 项目简介
查看>>
Wireshark抓取RTP包,还原语音
查看>>
Behavioral模式之Memento模式
查看>>
Work Management Service application in SharePoint 2016
查看>>
Dos 改动IP 地址
查看>>
Laravel 源码解读:php artisan make:auth
查看>>
【转】ionic run android 成功launch success,但是genymotion虚拟机没有显示
查看>>
苹果在GitHub上正式开源iOS内核源码
查看>>
测试人员面临的测试挑战和必备技能
查看>>
同事反馈环:为什么度量和会议还不够充分
查看>>
[转]十问 Linux 虚拟内存管理 (glibc)
查看>>
老司机带你深入浅出 Collection
查看>>
查询系统-vba
查看>>
[译]Spring Session 与 Spring Security
查看>>