- 创建 .idea 目录和相关配置文件,设置项目结构 - 添加多个课堂成果示例代码,涵盖不同主题和功能 - 创建和配置 .gitignore 文件,忽略特定文件和目录
56 lines
1.3 KiB
Python
56 lines
1.3 KiB
Python
#初始设置
|
||
import turtle as t
|
||
t.shape('turtle') #海龟形状
|
||
t.bgcolor('pink') #粉色背景
|
||
t.pencolor('black') #黑色画笔
|
||
t.pensize(10) #画笔宽度为10
|
||
|
||
#移到(0,-200),不留下痕迹
|
||
t.penup()
|
||
t.goto(0,-200)
|
||
t.pendown()
|
||
#画竖线
|
||
t.goto(0,0)
|
||
|
||
#画红色扇叶
|
||
t.fillcolor('red') #红色填充
|
||
t.begin_fill() #开始填充
|
||
t.seth(0) #朝向右
|
||
t.forward(100) #前进100像素
|
||
t.left(90) #左转90°,朝向左
|
||
t.circle(100,45) #画扇叶圆弧,角度45
|
||
t.goto(0,0) #回到原点
|
||
t.end_fill() #结束填充
|
||
|
||
#画黄色扇叶
|
||
t.fillcolor('yellow') #黄色填充
|
||
t.begin_fill() #开始填充
|
||
t.seth(90) #朝向上
|
||
t.forward(100) #前进100像素
|
||
t.left(90) #左转90°,朝向左
|
||
t.circle(100,45) #画扇叶圆弧,角度45
|
||
t.goto(0,0) #回到原点
|
||
t.end_fill() #结束填充
|
||
|
||
#画绿色扇叶
|
||
t.fillcolor('green') #绿色填充
|
||
t.begin_fill() #开始填充
|
||
t.seth(180) #朝向左
|
||
t.forward(100) #前进100像素
|
||
t.left(90) #左转90°,朝向下
|
||
t.circle(100,45) #画扇叶圆弧,角度45
|
||
t.goto(0,0) #回到原点
|
||
t.end_fill() #结束填充
|
||
|
||
#画蓝色扇叶
|
||
t.fillcolor('blue') #蓝色填充
|
||
t.begin_fill() #开始填充
|
||
t.seth(270) #朝向下
|
||
t.forward(100) #前进100像素
|
||
t.left(90) #左转90°,朝向右
|
||
t.circle(100,45) #画扇叶圆弧,角度45
|
||
t.goto(0,0) #回到原点
|
||
t.end_fill() #结束填充
|
||
|
||
t.done()
|