用户:
RainDawn_SATA查看:0 回复:0 评论:0 创建时间:2021-08-12T19:46:13
【作品展示】

【作品介绍】
可能会有亿点点麻烦
【作品源代码】
import turtle as t
import time
import easygui
from TheEnd import End
from for_set_expanse import setExpanse
setExpanse.set_ex()
class Graph():
def graph():
n = 0
distance = t.numinput(
'Write the the length of each side', 'Write the the length of each side(边的长度)')
where_x = t.numinput('where you want to start_draw',
'where you want to start_draw(x-axis)[x]')
where_y = t.numinput('where you want to start_draw',
'where you want to start_draw(y-axis)[y]')
fill_vule = t.numinput('Do you want fill the graph',
'Do you want fill the graph(fill = 0, not fill = 1 [numinput]{number数字})')
if easygui.ynbox('Do you want to change your fillcolor?', ' ', ('yes', 'no')):
t.fillcolor(t.textinput('write your fillcolor',
'write your fillcolor(string)[you have to write by yourself]'))
else:
pass
if easygui.ynbox('Do you want to change your pencolor?', ' ', ('yes', 'no')):
t.pencolor(t.textinput('write your pencolor',
'write your pencolor(string)[you have to write by yourself]'))
else:
pass
graph = t.textinput('What graph do you want to draw',
'What graph do you want to draw(triangle/三角形,rectangle/矩形, pentagon/五边形')
if str(graph) == "triangle" or str(graph) == "三角形":
graph = 0
elif str(graph) == "rectangle" or str(graph) == "矩形":
graph = 1
elif str(graph) == "pentagon" or str(graph) == "五边形":
graph = 2
t.penup()
t.goto(where_x, where_y)
t.pendown()
if fill_vule == 0:
if graph == 0:
n = 3
t.begin_fill()
for i in range(n):
t.fd(distance)
t.lt(360/n)
t.end_fill()
elif graph == 1:
n = 4
t.begin_fill()
for i in range(n):
t.fd(distance)
t.lt(360/n)
t.end_fill()
elif graph == 2:
n = 5
t.begin_fill()
for i in range(n):
t.fd(distance)
t.lt(360/n)
t.end_fill()
elif graph == 3:
t.begin_fill()
pass
t.end_fill()
elif fill_vule == 1:
if graph == 0:
n = 3
for i in range(n):
t.fd(distance)
t.lt(360/n)
elif graph == 1:
n = 4
for i in range(n):
t.fd(distance)
t.lt(360/n)
elif graph == 2:
n = 5
for i in range(n):
t.fd(distance)
t.lt(360/n)
elif graph == 3:
pass
if __name__ == "__main__":
m = t.numinput('How many graph you want to draw',
'How many graph you want to draw')
for i in range(int(m)):
Graph.graph()
time.sleep(1)
End.end("Graph_drawing")
t.done()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn