Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson3-5-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
272627a8
authored
Aug 16, 2020
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
07858a54
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
106 additions
and
0 deletions
ddd.py
ddd.py
0 → 100644
View file @
272627a8
import
turtle
pen
=
turtle
.
Pen
()
screen
=
turtle
.
Screen
()
screen
.
bgcolor
(
"light blue"
)
ho
=
screen
.
textinput
(
"外廓颜色:"
,
"(输入default或点击Cancel即为默认值):"
)
ht
=
screen
.
textinput
(
"填充颜色:"
,
"(输入default或点击Cancel即为默认值):"
)
hth
=
screen
.
textinput
(
"爱心的半径*2:"
,
"(输入default或点击Cancel即为默认值):"
)
pen
.
shape
(
"turtle"
)
h
=
0
pen
.
hideturtle
()
pen
.
speed
(
0
)
pen
.
width
(
5
)
pen
.
up
()
pen
.
goto
(
-
100
,
100
)
item
=
0
if
ho
==
"default"
or
ho
==
None
:
if
ht
==
"default"
or
ht
==
None
:
if
hth
==
"default"
or
hth
==
None
:
tuple_one
=
[
"pink"
,
"red"
,
40
]
tuple_two
=
[
"orange"
,
"grey"
,
30
]
tuple_three
=
[
"green"
,
"purple"
,
40
]
tuple_four
=
[
"blue"
,
"yellow"
,
30
]
tuple_five
=
[
"black"
,
"pink"
,
40
]
tuple_six
=
[
"yellow"
,
"blue"
,
30
]
tuple_seven
=
[
"red"
,
"orange"
,
40
]
tuple_eight
=
[
"purple"
,
"black"
,
30
]
tuple_nine
=
[
"grey"
,
"green"
,
40
]
h
=
1
if
h
==
0
:
if
ho
==
"default"
or
ho
==
None
:
tuple_one
[
0
]
=
"pink"
tuple_two
[
0
]
=
"orange"
tuple_three
[
0
]
=
"green"
tuple_four
[
0
]
=
"blue"
tuple_five
[
0
]
=
"black"
tuple_six
[
0
]
=
"yellow"
tuple_seven
[
0
]
=
"red"
tuple_eight
[
0
]
=
"purple"
tuple_nine
[
0
]
=
"grey"
else
:
tuple_one
[
0
]
=
ho
tuple_two
[
0
]
=
ho
tuple_three
[
0
]
=
ho
tuple_four
[
0
]
=
ho
tuple_five
[
0
]
=
ho
tuple_six
[
0
]
=
ho
tuple_seven
[
0
]
=
ho
tuple_eight
[
0
]
=
ho
tuple_nine
[
0
]
=
ho
if
ht
==
"default"
or
ht
==
None
:
d
else
:
tuple_one
[
0
]
=
ht
tuple_two
[
0
]
=
ht
tuple_three
[
0
]
=
ht
tuple_four
[
0
]
=
ht
tuple_five
[
0
]
=
ht
tuple_six
[
0
]
=
ht
tuple_seven
[
0
]
=
ht
tuple_eight
[
0
]
=
ht
tuple_nine
[
0
]
=
ht
for
i
in
range
(
3
):
for
j
in
range
(
3
):
if
item
==
1
:
turtle_list
=
[
tuple_one
[
0
],
tuple_one
[
1
],
tuple_one
[
2
]]
elif
item
==
2
:
turtle_list
=
[
tuple_two
[
0
],
tuple_two
[
1
],
tuple_two
[
2
]]
elif
item
==
3
:
turtle_list
=
[
tuple_three
[
0
],
tuple_three
[
1
],
tuple_three
[
2
]]
elif
item
==
4
:
turtle_list
=
[
tuple_four
[
0
],
tuple_four
[
1
],
tuple_four
[
2
]]
elif
item
==
5
:
turtle_list
=
[
tuple_five
[
0
],
tuple_five
[
1
],
tuple_five
[
2
]]
elif
item
==
6
:
turtle_list
=
[
tuple_six
[
0
],
tuple_six
[
1
],
tuple_six
[
2
]]
elif
item
==
7
:
turtle_list
=
[
tuple_seven
[
0
],
tuple_seven
[
1
],
tuple_seven
[
2
]]
elif
item
==
8
:
turtle_list
=
[
tuple_eight
[
0
],
tuple_eight
[
1
],
tuple_eight
[
2
]]
else
:
turtle_list
=
[
tuple_nine
[
0
],
tuple_nine
[
1
],
tuple_nine
[
2
]]
pen
.
pencolor
(
turtle_list
[
0
])
pen
.
fillcolor
(
turtle_list
[
1
])
pen
.
down
()
pen
.
begin_fill
()
pen
.
left
(
45
)
pen
.
forward
(
turtle_list
[
2
])
pen
.
circle
(
turtle_list
[
2
]
/
2
,
180
)
pen
.
right
(
90
)
pen
.
circle
(
turtle_list
[
2
]
/
2
,
180
)
pen
.
forward
(
turtle_list
[
2
])
pen
.
left
(
45
)
pen
.
end_fill
()
pen
.
up
()
pen
.
forward
(
100
)
pen
.
down
()
item
+=
1
pen
.
up
()
pen
.
right
(
90
)
pen
.
forward
(
100
)
pen
.
right
(
90
)
pen
.
forward
(
300
)
pen
.
left
(
180
)
pen
.
down
()
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