zoukankan      html  css  js  c++  java
  • turtle画五角星

     1 import turtle
     2 
     3 
     4 def mygoto(x,y):
     5     turtle.up()
     6     turtle.goto(x,y)
     7     turtle.down()
     8 
     9 
    10 def drawstar(l):
    11     turtle.fillcolor('yellow')
    12     turtle.color('yellow')
    13     turtle.begin_fill()
    14     for i in range(5):
    15         turtle.forward(l)
    16         turtle.right(144)
    17     turtle.end_fill()
    18 
    19 
    20 mygoto(-320,-260)
    21 turtle.color('red')
    22 turtle.fillcolor('red')
    23 turtle.begin_fill()
    24 for i in range(2):
    25     turtle.forward(660)
    26     turtle.left(90)
    27     turtle.forward(440)
    28     turtle.left(90)
    29 turtle.end_fill()
    30 
    31 mygoto(-270,100)
    32 drawstar(100)
    33 
    34 for i in range(4):
    35     x = 1
    36     if i in [0,3]:
    37         x = 0
    38     mygoto(-150+x*50,150-i*40)
    39     turtle.left(15-i*15)
    40     drawstar(30)
    41 
    42 mygoto(0,0)
    43 turtle.hideturtle()
    44 turtle.done()

  • 相关阅读:
    数据结构
    ADC
    SPI
    定时器原理
    IO中断
    恩智浦样片申请
    UART
    随机生成数字验证码
    判断网络是否连接Internet
    清理SQL数据库日志
  • 原文地址:https://www.cnblogs.com/ChalingStreet/p/8610918.html
Copyright © 2011-2022 走看看