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
e8205958
authored
May 02, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
2a16472e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
diy.py
diy.py
View file @
e8205958
import
turtle
# 导入turtle模块
# 背景颜色
screen
=
turtle
.
Screen
()
# 取出画布背景并赋值给变量Screen
screen
.
bgcolor
(
"light blue"
)
# 改变背景颜色为blue
# 写字
# pen=turtle.Pen() # 创建画笔,调用turtle模块.Pen方法首字母大写
pen
=
turtle
.
Pen
()
# 创建画笔Pen
pen
.
penup
()
# 抬起画笔
pen
.
goto
(
100
,
-
100
)
# 将文字画笔移至爱心右下角位置
# 用write()方法将内容写在画布上,参1书写内容(\n换行)参2字体名称大小类型赋值给font(元组)
# pen.write("诺依,\nturtle真好用,\n我会在画布上写字了",font=("Times",30,"normal"))
# pen.hideturtle() # 调用hideturtle()方法隐藏画笔
# turtle.done() # 保存画布
pen
.
write
(
"诺依,
\n
turtle真好用,
\n
我会在画布上写字了"
,
font
=
(
"Times"
,
15
,
"normal"
))
pen
.
hideturtle
()
# 调用hideturtle()方法隐藏画笔
# 画爱心
pen1
=
turtle
.
Pen
()
# 新建画笔Pen1
pen1
.
pencolor
(
"red"
)
# 设置线条的颜色
...
...
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