Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson3-2_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
8ac9efc4
authored
Oct 16, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
69d18600
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
17 deletions
Day1.py
Day1.py
View file @
8ac9efc4
import
turtle
import
turtle
#创建画布
screen
=
turtle
.
Screen
()
#创建画布
#设置画布颜色
screen
.
bgcolor
(
"yellow"
)
#设置画布颜色
pen
=
turtle
.
Pen
()
pen
=
turtle
.
Pen
()
#抬笔
pen
.
penup
()
#抬笔
#画笔移到50,-100
pen
.
goto
(
50
,
-
100
)
#画笔移到50,-100
pen
.
write
(
"你好呀"
,
font
=
(
"Times"
,
20
,
"normal"
))
pen
.
write
(
"你好呀"
,
font
=
(
"Times"
,
20
,
"normal"
))
turtle
.
done
()
#删掉这行
#创建新画笔pen1
#设置画笔大小
len
=
screen
.
textinput
(
"提示"
,
"你想要画一个多大的爱心呀"
)
#设置画笔颜色
lovesize
=
int
(
len
)
#创建一个变量len,储存圆的半径
#绘制爱心
#左转45°
pen1
=
turtle
.
Pen
()
#创建新画笔pen1
#移动100步
pen1
.
pensize
(
10
)
#设置画笔大小
#画一个半径为50的半圆
pen1
.
pencolor
(
"red"
)
#设置画笔颜色
#右转90°
pen1
.
left
(
45
)
#左转45°
#画一个半径为50的半圆
pen1
.
forward
(
lovesize
*
2
)
#移动2*len步
#移动100步
pen1
.
circle
(
lovesize
,
180
)
#画一个半径为len的半圆
#保存画布
pen1
.
right
(
90
)
#右转90°
\ No newline at end of file
pen1
.
circle
(
lovesize
,
180
)
#画一个半径为len的半圆
pen1
.
forward
(
lovesize
*
2
)
#移动2*len步
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