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
f5a90ba5
authored
May 06, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
c2f1308f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
2 deletions
1.py
2.py
diy1.py
1.py
0 → 100644
View file @
f5a90ba5
1.
pen
.
write
(
文字内容,字体参数
)
2.
文字内容是一个字符串
3.
字体参数时一个元组
包含
3
个小的参数
字体名称
(
str
)
字体大小
(
int
)
字体类型
(
str
)
4.
元组和列表很相似,列表使用中括号,
元组使用小括号
5.
\
n
转义字符
换行
需要放到引号里边
6.
pen
.
circle
(
半径,夹角
)
7.
直径
=
2
*
半径
8.
画笔粗细:
pen
.
pensize
()
9.
画笔颜色:
pen
.
pencolor
()
10.
抬笔:
pen
.
penup
()
11.
落笔:
pen
.
pendown
()
12.
移动坐标:
pen
.
goto
(
x
,
y
)
13.
创建画布:
screen
=
turtle
.
Screen
()
14.
设置背景颜色:
screen
.
bgcolor
(
"颜色"
)
15.
screen
.
textinput
(
标题,问题
)
标题和问题都是字符串类型
16.
数据类型转换函数
int
()
将整数的字符串或者是小数
转换为整数
float
()
将整数转换为小数
或者是将字符串转换为小数
但必须是数字的形式
str
()
将目标转换为字符串
\ No newline at end of file
2.py
0 → 100644
View file @
f5a90ba5
a
=
'[123,13]'
b
=
str
(
a
)
print
(
b
)
print
(
type
(
b
))
\ No newline at end of file
diy1.py
View file @
f5a90ba5
# 利用write()帮助悟空给诺依回信吧~
# 利用write()帮助悟空给诺依回信吧~
\ No newline at end of file
#1.导入
import
turtle
2.
创建画笔
pen
=
turtle
.
Pen
()
#3.使用write函数来写一段文字
#4.隐藏画笔形状
pen
.
hideturtle
()
#5.保留画布
#画爱心
pen1
=
turtle
.
Pen
()
#0.设置粗细和颜色
#1.左转45
#2.移动100
#3.画半圆 半径为50 夹角180
#4.右转90
#5.画半圆 半径为50 夹角180
#6.移动100
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