博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Python - 用 turtle 绘制圆形
阅读量:4091 次
发布时间:2019-05-25

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

、、

  • Turtle 库是 Python 语言中一个很流行的绘制图像的函数库

  • Turtle 库用于绘制线、圆、其他形状或者文本

  • 显示小乌龟的爬行轨迹,初始小乌龟在(0, 0),前进方向为 x 轴正方向

  • 绘制圆形

    import turtleturtle.color('red')turtle.circle(39)turtle.done()
  • turtle.circle(radius,extent,step)

    • radius 是必需的,表示半径,正值时逆时针旋转
    • extent 表示度数,用于绘制圆弧;
    • step 表示边数,可用于绘制正多边形;
    • extent 和 step 参数可有可无。
  • 实例1

    import turtleturtle.color('orange')turtle.pensize(3)turtle.circle(75)turtle.penup()turtle.goto(0, -200)turtle.pendown()turtle.circle(100)turtle.done()

    这里写图片描述

  • 实例2

    import turtleturtle.color('purple')for i in range(10):  turtle.circle(i*10)  turtle.left(126)turtle.done()

    这里写图片描述

你可能感兴趣的文章
PHP底层的运行机制与原理
查看>>
php 几个比较实用的函数
查看>>
PHP5各个版本的新功能和新特性总结
查看>>
深入了解php底层机制
查看>>
PHP中的stdClass 【转】
查看>>
XHProf-php轻量级的性能分析工具
查看>>
PHP7新特性 What will be in PHP 7/PHPNG
查看>>
比较strtr, str_replace和preg_replace三个函数的效率
查看>>
ubuntu 下编译PHP5.5.7问题:configure: error: freetype.h not found.
查看>>
PHP编译configure时常见错误 debian centos
查看>>
configure: error: Please reinstall the BZip2 distribution
查看>>
leetcode 130. Surrounded Regions(被围绕的区域)
查看>>
#define的用法
查看>>
被遗忘的C结构体封装技术
查看>>
STM32F429使用STM32CUBMX5.6移植touchGFX4.13
查看>>
Plugin Android Material Design Icon Generator was not installed: Cannot download ,Read timed out
查看>>
The SDK platform-tools version (27.0.1) is too old to check APIs compiled with API 28
查看>>
Could not find support-fragment.jar (com.android.support:support-fragment:27.1.1)
查看>>
android studo无法预览xml布局效果failed to load AppCompat ActionBar with unkNown error
查看>>
Error: Invoke-customs are only supported starting with Android O (--min-api 26)
查看>>