3.30-18.30-python-半圆风车-笔记
n = int(input()) #输入风扇叶子数量
import turtle as t #引入海龟 绘图库
import random #引入随机库
t.bgcolor('gray') #设置背景颜色为 灰色
#01.风车 手柄
t.setheading(270) #设置绝对角度 朝下
t.pensize(20) #笔大小为:20
t.fd(300) #朝下前进 300
#02.抬笔 定位 落笔 到中心点
t.penup()
t.goto(0, 0)
t.pendown()
#03.绘制风扇叶子
t.setheading(60) #绝对角度为60
t.colormode(255) #设置颜色模式为RGB模式
for i in range(n): #循环输入的整数:n次
a = random.randint(0, 255) #a是随机整数0到255中一个
b = random.randint(0, 255)
c = random.randint(0, 255)
t.color(a, b, c) #设置RGB值
t.begin_fill() #开始填充
t.forward(150)
t.left(90)
t.circle(75,180) #半圆
t.left(90)
t.end_fill() # 结束填充
#注意:画完1个后,需要转角度
t.left(360/n)
#04.风车中心原点
t.dot(20, 'white')
t.hideturtle() #隐藏海龟
t.done()