Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson7_5
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
3eb39bcb
authored
Jan 14, 2024
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
35b6a18a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
demo.py/demo.py
demo.py/demo.py
0 → 100644
View file @
3eb39bcb
import
turtle
# 创建画布
screen
=
turtle
.
Screen
()
# 设置画布颜色
screen
.
bgcolor
(
"red"
)
#设置画布颜色
# 3,创建一只写字画笔
pen
=
turtle
.
Pen
()
pen
.
penup
()
#抬笔
pen
.
goto
(
133
,
66
)
#参数分别是,内容,字体名称,字体大小,字体类型
pen
.
write
(
"内
\n
容"
,
font
=
(
"Times"
,
20
,
"normal"
))
pen
.
pensize
()
# 创建对话框
len
=
screen
.
textinput
(
"对话框标题"
,
"输入爱心大小"
)
size
=
int
(
len
)
# 4,创建一只画爱心的画笔
pen1
=
turtle
.
Pen
()
# 设置画笔颜色
pen1
.
color
()
# 画爱心
# 先设置朝向
pen1
.
left
(
45
)
pen1
.
forward
(
size
*
2
)
#往前直行
pen1
.
circle
(
size
,
180
)
#第一个参数是半径,第二个参数是度数
# 隐藏画笔
pen1
.
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