Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson3-1-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
d07ce4e5
authored
Jun 01, 2024
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
c66a449e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
22 deletions
diy1.py
diy1.py
View file @
d07ce4e5
# 利用write()帮助悟空给诺依回信吧~
import
turtle
screen
=
turtle
.
Screen
()
screen
.
bgcolor
(
"light blue"
)
len
=
screen
.
textinput
(
"100"
,
"100"
)
len
=
int
(
len
)
pen
=
turtle
.
Pen
()
pen
.
write
(
"你好
\n
SB."
,
font
=
(
"Times"
,
30
,
"normal"
)
)
pen
.
hideturtle
()
len
=
60
pen
.
penup
(
)
pen
.
goto
(
100
,
100
)
pen
.
pendown
()
pen
.
pensize
(
5
)
pen
.
pencolor
(
"red"
)
pen
.
left
(
45
)
pen
.
forward
(
2
*
len
)
pen
.
circle
(
len
,
18
0
)
pen
.
right
(
90
)
pen
.
circle
(
len
,
180
)
pen
.
forward
(
2
*
len
)
turtle
.
done
()
import
turtle
#导入turtle模块
screen
=
turtle
.
Screen
()
#将Screen()方法赋值给变量screen
screen
.
bgcolor
(
"pink"
)
#设置背景色
turtle
.
penup
()
#抬笔
turtle
.
goto
(
150
,
-
150
)
#移动到(x,y)处
turtle
.
write
(
"李白你好,
\n
我想邀请你
\n
参加诗友会
\n
时间在明晚八点
\n
————杜甫"
,
font
=
(
"Times"
,
20
,
"normal"
))
#write()方法绘制文本
turtle
.
goto
(
0
,
0
)
turtle
.
pendown
()
#绘制爱心
turtle
.
pensize
(
5
)
turtle
.
pencolor
(
"red"
)
turtle
.
left
(
45
)
turtle
.
forward
(
100
)
turtle
.
circle
(
50
,
180
)
turtle
.
right
(
90
)
turtle
.
circle
(
50
,
180
)
turtle
.
forward
(
10
0
)
#隐藏画笔
turtle
.
hideturtle
(
)
#让窗口停留
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