代码拉取完成,页面将自动刷新
# coding=utf-8
from tkinter import *
from PIL import Image, ImageTk
from oblique import outputOblique
from straight import outputStraight
strInp = ["", "", "", "", "", "", "", "", ""]
oblInp = ["", "", "", "", "", "", "", "", "", "", "", "", ""]
strData = [15000, 2000, 30, 58890, 32.4, 2.65, 34500, 235, 200000]
oblData = [100, 235, 200000, 30, 2906.604147, 15000, 2000, 58890, 32.4, 2.65, 34500, 235, 200000]
def straight():
txt.insert(END, "基于正裂缝信息的混凝土简支梁受弯状态评估结果:\n")
global strData
res = outputStraight(float(strData[0]), float(strData[1]), float(strData[2]), float(strData[3]), float(strData[4]),
float(strData[5]), float(strData[6]), float(strData[7]), float(strData[8]), 4643) # 有默认参数
txt.insert(END, res)
def oblique():
txt.insert(END, "基于斜裂缝信息的钢筋混凝土简支梁受剪状态评估结果:\n")
global oblData
res = outputOblique(float(oblData[0]), float(oblData[1]), float(oblData[2]), float(oblData[3]), float(oblData[4]),
float(oblData[5]), float(oblData[6]), float(oblData[7]), float(oblData[8]), float(oblData[9]),
float(oblData[10]), float(oblData[11]), float(oblData[12])) # 有默认参数
txt.insert(END, res)
def edit():
tk = Tk()
tk.title("数据编辑器")
tk.geometry('960x480')
straightText = ["宽度b(mm)",
"高度h(mm)",
"钢筋合力作用点到边缘的距离δs(mm)",
"钢筋截面积As(mm^2)",
"混凝土抗压强度fc (Mpa)",
"混凝土抗拉强度ft(Mpa)",
"混凝土弹性模量Ec(Mpa)",
"钢筋屈服fy(Mpa)",
"钢筋弹性模量Es(Mpa)"]
obliqueText = ["握筋间距S(mm)",
"箍筋屈服强度fyVs(Mpa)",
"箍筋弹性模量Es(Mpa)",
"钢筋合力作用点到边缘的距离δs(mm)",
"箍筋截面积Asvs(mm^2)",
"宽度b(mm)",
"高度h(mm)",
"钢筋截面积As(mm^2)",
"混凝土抗压强度fc (Mpa)",
"混凝土抗拉强度ft(Mpa)",
"混凝土弹性模量Ec(Mpa)",
"钢筋屈服fy(Mpa)",
"钢筋弹性模量Es(Mpa)"
]
# 标签控件,显示文本和位图,展示在第一行
Label(tk, text="截面和材料参数输入(正裂缝)").grid(row=0, column=0, sticky=E)
for i in range(0, 5):
Label(tk, text=straightText[i]).grid(row=i + 1, column=0, sticky=W)
for i in range(0, 4):
Label(tk, text=straightText[i + 5]).grid(row=i + 1, column=2, sticky=W)
Label(tk, text="截面和材料参数输入(斜裂缝)").grid(row=6, sticky=E)
for i in range(0, 7):
Label(tk, text=obliqueText[i]).grid(row=i + 7, column=0, sticky=W)
for i in range(0, 6):
Label(tk, text=obliqueText[i + 7]).grid(row=i + 7, column=2, sticky=W)
# 输入控件
for i in range(0, 5):
strInp[i] = Entry(tk)
strInp[i].grid(row=i + 1, column=1)
for i in range(0, 4):
strInp[i + 5] = Entry(tk)
strInp[i + 5].grid(row=i + 1, column=3)
for i in range(0, 7):
oblInp[i] = Entry(tk)
oblInp[i].grid(row=i + 7, column=1)
for i in range(0, 6):
oblInp[i + 7] = Entry(tk)
oblInp[i + 7].grid(row=i + 7, column=3)
# btn = Button(tk, text="确认")
btn = Button(tk, text="确认", command=alter)
btn.grid(row=16, column=0, sticky=W)
def alter():
for i in range(0, 9):
s = strInp[i].get()
s.strip()
s.lstrip()
s.rstrip()
if s != "":
strData[i] = float(s)
for i in range(0, 13):
s = oblInp[i].get()
s.strip()
s.lstrip()
s.rstrip()
if s != "":
oblData[i] = float(s)
def fresh():
txt.delete(1.0, END)
# 基础设置
root = Tk()
root.title('桥梁承载能力评估模型')
root.geometry('1080x720')
root.configure(background='#272627')
img = Image.open("logo/logo.png")
photo = ImageTk.PhotoImage(img)
logo = Label(root, image=photo, bg='#272627')
logo.place(relx=0.1, rely=0.55, relwidth=0.3, relheight=0.35)
# 标题 - 桥梁承载能力评估模型
lb1 = Label(root, text='桥梁承载能力评估模型', bg='#272627', fg='#A0CBF1', font=("黑体", 32, 'bold'))
lb1.place(relx=0.1, rely=0.1, relheight=0.1)
# 按钮(上) - 基于正裂缝信息的混凝土简支梁受弯状态评估
btn1 = Button(root, text='基于正裂缝信息的混凝土简支梁受弯状态评估',
command=straight, bg='#333232', fg='#A0CBF1',
activebackground='#272626', activeforeground='#9B9B9B')
btn1.place(relx=0.1, rely=0.3, relwidth=0.3, relheight=0.1)
# 按钮(下) - 基于斜裂缝信息的钢筋混凝土简支梁受剪状态评估
btn2 = Button(root, text='基于斜裂缝信息的钢筋混凝土简支梁受剪状态评估',
command=oblique, bg='#333232', fg='#A0CBF1',
activebackground='#272626', activeforeground='#9B9B9B')
btn2.place(relx=0.1, rely=0.4, relwidth=0.3, relheight=0.1)
# 结果输出框 - 在窗体垂直自上而下位置30%处起,布局相对窗体高度60%高的文本框
txt = Text(root, fg='#E1E1E1', bg='#323232', relief=FLAT)
txt.place(relx=0.5, rely=0.1, relheight=0.8, relwidth=0.4)
# 按钮 - 清空结果
btn3 = Button(root, text='清空结果', command=fresh,
bg='#333232', fg='#9B9B9B',
activebackground='#272626', activeforeground='#9B9B9B')
btn3.place(relx=0.1, rely=0.25, relwidth=0.1, relheight=0.05)
# 按钮 - 数据编辑器
btn4 = Button(root, text='数据编辑器', command=edit,
bg='#333232', fg='#9B9B9B',
activebackground='#272626', activeforeground='#9B9B9B')
btn4.place(relx=0.2, rely=0.25, relwidth=0.15, relheight=0.05)
root.mainloop()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。