Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson3-5-1_DIY1
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b371a06a
authored
May 22, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
07858a54
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
2.py
2.py
0 → 100644
View file @
b371a06a
import
turtle
#加载turtle功能
screen
=
turtle
.
Screen
()
#将turtle中的Screen()函数放入screen变量
screen
.
bgcolor
(
"pink"
)
#背景颜色设置为"pink"(粉色)
pen
=
turtle
.
Pen
()
#将turtle中的Pen()函数放入pen变量
pen
.
write
(
"离离原上草
\n
一岁一枯荣"
,
font
=
(
"Times"
,
15
,
"normal"
))
#输入内容,需要换行时使用\n功能,标准字体“Times”,大小15,类型
#“normal”
pen
.
hideturtle
(
)
#隐藏画笔pen
pen1
=
turtle
.
Pen
()
#将turtle中的Pen()函数放入pen1变量
pen1
.
penup
()
#抬笔
pen1
.
goto
(
-
100
,
0
)
#移动到(-100,0)的位置
pen1
.
pencolor
(
"red"
)
#画笔颜色红色“red”
pen1
.
pensize
(
5
)
#画笔粗细5
pen1
.
pendown
()
#落笔
len
=
int
(
turtle
.
textinput
(
"提示"
,
"输入心形的大小"
))
pen1
.
left
(
45
)
#左转45°
pen1
.
forward
(
2
*
len
)
#前进100
pen1
.
circle
(
len
,
180
)
#画一个半径50的圆,画180的范围
pen1
.
right
(
90
)
#右转90
pen1
.
circle
(
len
,
180
)
#画一个半径50的圆,画180的范围
pen1
.
forward
(
2
*
len
)
#前进100
pen1
.
hideturtle
()
#隐藏画笔pen1
turtle
.
done
()
#结束绘画但不关闭画布
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment