Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson1_1
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
16e45694
authored
Jun 13, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
431fbeaa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
89 additions
and
2 deletions
hello.py
hello.py
View file @
16e45694
print
(
"hello word!"
)
# import turtle as t
\ No newline at end of file
# t.penup()
# t.seth(-90)
# t.fd(160)
# t.pendown()
# t.pensize(20)
# t.colormode(255)
# t.speed(1000)
# t.pencolor(250,50,150)
from
turtle
import
*
from
time
import
sleep
def
go_to
(
x
,
y
):
up
()
goto
(
x
,
y
)
down
()
def
big_Circle
(
size
):
#函数用于绘制心的大圆
speed
(
10
)
for
i
in
range
(
150
):
forward
(
size
)
right
(
0.3
)
def
small_Circle
(
size
):
#函数用于绘制心的小圆
speed
(
10
)
for
i
in
range
(
210
):
forward
(
size
)
right
(
0.786
)
def
line
(
size
):
speed
(
1
)
forward
(
51
*
size
)
def
heart
(
x
,
y
,
size
):
go_to
(
x
,
y
)
left
(
150
)
begin_fill
()
line
(
size
)
big_Circle
(
size
)
small_Circle
(
size
)
left
(
120
)
small_Circle
(
size
)
big_Circle
(
size
)
line
(
size
)
end_fill
()
def
arrow
():
pensize
(
10
)
setheading
(
0
)
go_to
(
-
400
,
0
)
left
(
15
)
forward
(
150
)
go_to
(
339
,
178
)
forward
(
150
)
def
arrowHead
():
pensize
(
1
)
speed
(
5
)
color
(
'red'
,
'red'
)
begin_fill
()
left
(
120
)
forward
(
20
)
right
(
150
)
forward
(
35
)
right
(
120
)
forward
(
35
)
right
(
150
)
forward
(
20
)
end_fill
()
def
main
():
pensize
(
2
)
color
(
'red'
,
'pink'
)
#getscreen().tracer(30, 0) #取消注释后,快速显示图案
heart
(
200
,
0
,
1
)
#画出第一颗心,前面两个参数控制心的位置,函数最后一个参数可控制心的大小
setheading
(
0
)
#使画笔的方向朝向x轴正方向
heart
(
-
80
,
-
100
,
1.5
)
#画出第二颗心
arrow
()
#画出穿过两颗心的直线
arrowHead
()
#画出箭的箭头
go_to
(
300
,
-
300
)
write
(
"母亲节快乐!"
,
move
=
True
,
align
=
"left"
,
font
=
(
"宋体"
,
30
,
"normal"
))
done
()
main
()
\ 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