zoukankan      html  css  js  c++  java
  • python 五角星 六角星 叠加等边三角形

    五角星

     1 #wujioxin.py
     2 import turtle
     3 turtle.fillcolor("red")
     4 turtle.begin_fill()
     5 while True:
     6     turtle.forward(220)
     7     turtle.right(144)
     8     if abs(turtle.pos()) < 1:
     9         break
    10 turtle.fd(84)
    11 for i in range(5):
    12     turtle.fd(52)
    13     turtle.right(72)
    14 turtle.end_fill()
    15 turtle.done()

    六角星

     1 import turtle as t
     2 t.pencolor("red")
     3 t.left(30)
     4 t.fd(144)
     5 t.right(60)
     6 t.fd(144)
     7 t.right(60)
     8 t.fd(144)
     9 t.right(60)
    10 t.fd(144)
    11 t.right(60)
    12 t.fd(144)
    13 t.right(60)
    14 t.fd(144)
    15 t.fd(144)
    16 t.right(120)
    17 t.fd(144)
    18 t.left(60)
    19 t.fd(144)
    20 t.right(120)
    21 t.fd(144)
    22 t.left(60)
    23 t.fd(144)
    24 t.right(120)
    25 t.fd(144)
    26 t.left(60)
    27 t.fd(144)
    28 t.right(120)
    29 t.fd(144)
    30 t.left(60)
    31 t.fd(144)
    32 t.right(120)
    33 t.fd(144)
    34 t.left(60)
    35 t.fd(144)
    36 t.right(120)
    37 t.fd(144)
    38 t.done()

     

    叠加等边三角形绘制

     1 import turtle as t
     2 t.pendown()
     3 t.pencolor("yellow")  #笔触为黄色
     4 #绘制外部大三角形
     5 t.fd(300)
     6 t.seth(120)
     7 t.fd(300)
     8 t.seth(-120)
     9 t.fd(300)
    10 #绘制内部小三角形
    11 t.seth(0)
    12 t.fd(150)
    13 t.seth(60)
    14 t.fd(150)
    15 t.seth(180)
    16 t.fd(150)
    17 t.seth(-60)
    18 t.fd(150)
    19 t.seth(120)
    20 t.fd(150)
    21 t.seth(0)
    22 t.penup()
    23 t.done()

     

    2020-03-11

  • 相关阅读:
    C#连接Oracle数据库的连接字符串
    Oracle
    SQL 计算某月有多少天
    七牛开发者文档中心
    ocrstyle
    Linux的sys接口和proc接口创建
    BusHelper
    MeiTuanLocateCity
    Shop
    Win10预览版10162全新安装及激活全过程图解
  • 原文地址:https://www.cnblogs.com/ghh0/p/12464639.html
Copyright © 2011-2022 走看看