You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
class Ways():
|
|
|
|
|
def way_change(self):
|
|
|
|
|
global entry3, entry4
|
|
|
|
|
value1 = entry3.get() # 获取第一个输入框的值
|
|
|
|
|
value2 = entry4.get() # 获取第二个输入框的值
|
|
|
|
|
try:
|
|
|
|
|
value1 = int(value1) # 将值转换为整数
|
|
|
|
|
value2 = int(value2) # 将值转换为整数
|
|
|
|
|
print("值1:", value1)
|
|
|
|
|
print("值2:", value2)
|
|
|
|
|
ways_list = [int(node[1]) for node in d.Nodes]
|
|
|
|
|
# 判断两点是否连接
|
|
|
|
|
if abs(value2) > 10 and abs(value1) > 10:
|
|
|
|
|
tk.messagebox.askokcancel(title='错误', message='请重新输入正确的编号!')
|
|
|
|
|
return
|
|
|
|
|
else:
|
|
|
|
|
if value1 < value2:
|
|
|
|
|
str_route = f'{value1}-{value2}'
|
|
|
|
|
else:
|
|
|
|
|
str_route = f'{value2}-{value1}'
|
|
|
|
|
no = 0
|
|
|
|
|
for item in d.Edges:
|
|
|
|
|
if str_route == item[5]:
|
|
|
|
|
no = G.node_edge(value1 - 1, value2 - 1)
|
|
|
|
|
if d.Edges[no][3] == 0:
|
|
|
|
|
tk.messagebox.askokcancel(title='提醒', message='当前路线不存在!')
|
|
|
|
|
return
|
|
|
|
|
top = creat_window(str_route + '路径参数修改') # 创建弹出窗口
|
|
|
|
|
distance_entry = create_input_box(top, "路程/公里:(1-99)", d.Edges[no][6]) # 创建一个输入框,获取卷积核大小
|
|
|
|
|
time_entry = create_input_box(top, "时间/h:(1-99)", d.Edges[no][7]) # 创建一个输入框,获取卷积步长
|
|
|
|
|
def get_input(): # 创建
|
|
|
|
|
···与前面way_add里get_input相似
|
|
|
|
|
button = tk.Button(top, text="获取信息", command=get_input)
|
|
|
|
|
button.pack()
|
|
|
|
|
except ValueError:
|
|
|
|
|
tk.messagebox.askokcancel(title='错误', message='请输入正确的城市编号!')
|