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
2a16472e
authored
Apr 30, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
f40d896f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
diy.py
diy.py
View file @
2a16472e
import
turtle
# 导入turtle模块
# 写字
pen
=
turtle
.
Pen
()
# 创建画笔,调用turtle模块.Pen方法首字母大写
# 用write()方法将内容写子啊画布上,参1书写内容(\n换行)参2字体名称大小类型赋值给font(元组)
pen
.
write
(
"诺依,
\n
turtle真好用,
\n
我会在画布上写字了"
,
font
=
(
"Times"
,
30
,
"normal"
))
pen
.
hideturtle
()
# 调用hideturtle()方法隐藏画笔
# pen=turtle.Pen() # 创建画笔,调用turtle模块.Pen方法首字母大写
# 用write()方法将内容写在画布上,参1书写内容(\n换行)参2字体名称大小类型赋值给font(元组)
# pen.write("诺依,\nturtle真好用,\n我会在画布上写字了",font=("Times",30,"normal"))
# pen.hideturtle() # 调用hideturtle()方法隐藏画笔
# turtle.done() # 保存画布
# 画爱心
pen1
=
turtle
.
Pen
()
# 新建画笔Pen1
pen1
.
pencolor
(
"red"
)
# 设置线条的颜色
pen1
.
pensize
(
5
)
# 设置线条的粗细
pen1
.
left
(
45
)
# 左转45
pen1
.
forward
(
100
)
# 向前100
pen1
.
circle
(
50
,
180
)
# 画出半圆50,180
pen1
.
right
(
90
)
# 右转90
pen1
.
circle
(
50
,
180
)
# 画出半圆50,180
pen1
.
forward
(
100
)
# 向前100
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