zoukankan      html  css  js  c++  java
  • python turtle 学习笔记

    Python turtle库

    Turtle库是Python语言中一个很流行的绘制图像的函数库,这次我们就用turtle库绘制一个有关我们中国传统的图片——太极图

    代码

    import turtle
    t=turtle.Turtle()
    t.penup()
    t.goto(0,-50)
    t.pendown()
    t.begin_fill()
    t.fillcolor('black')
    t.circle(150,extent=180)
    t.circle(75,extent=180)
    t.circle(-75,extent=180)
    t.end_fill()
    t.circle(-150,extent=180)
    t.penup()
    t.goto(0,160)
    t.pendown()
    t.begin_fill()
    t.fillcolor("white")
    t.circle(30,extent=360)
    t.end_fill()
    t.penup()
    t.goto(0,0)
    t.pendown()
    t.begin_fill()
    t.fillcolor("black")
    t.circle(30,extent=360)
    t.end_fill()turtle.done()

    结果

  • 相关阅读:
    暴力,DFS,比较字符串
    暴力求解最大乘积
    油田!
    八皇后的问题
    巡逻的机器人
    骑士的移动
    二叉树遍历
    新兵训练(=@__@=)
    打牌~~~
    八皇后
  • 原文地址:https://www.cnblogs.com/wjxk/p/12554551.html
Copyright © 2011-2022 走看看