[Python] 纯文本查看 复制代码
from tkinter import *
from tkinter import ttk
class tanZhen:
def __init__(self, root):
# 窗口属性
root.title("探针数据处理")
ww = 800
wh = 600
sw = root.winfo_screenwidth()
sh = root.winfo_screenheight()
# 计算窗口位置
x = (sw-ww) / 2
y = (sh-wh) / 2
root.geometry("%dx%d+%d+%d" % (ww, wh, x, y))
# 创建组件
mainframe = ttk.Frame(root, padding="50 30")
# 渲染组件
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
# 响应式布局
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
# 选择文件标签
label_select_file = ttk.Label(mainframe, text="选择文件")
label_select_file.grid(row=0, column=0, sticky=W, pady=10)
label_select_file.config(font=("宋体", 12, "bold"))
# 探针标签框
ttk.Label(mainframe, text="探针表").grid(row=1, column=0, sticky=W)
# 探针输入框
self.entry_tanzhen = StringVar()
entry_tanzhen = ttk.Entry(mainframe, textvariable=self.entry_tanzhen)
entry_tanzhen.grid(row=1, column=1, sticky=(W, E), padx=10, pady=10)
# 响应式布局
mainframe.columnconfigure(1, weight=1)
# 探针选择按钮
btn_tanzhen = ttk.Button(mainframe, text='选择', command='')
btn_tanzhen.grid(row=1, column=2)
# 全量资源标签框
ttk.Label(mainframe, text="全量资源表").grid(row=2, column=0, sticky=W)
# 全量资源输入框
self.entry_ziyuan = StringVar()
entry_ziyuan = ttk.Entry(mainframe, textvariable=self.entry_ziyuan)
entry_ziyuan.grid(row=2, column=1, sticky=(W, E), padx=10, pady=10)
# 响应式布局
mainframe.columnconfigure(1, weight=1)
# 全量资源选择按钮
btn_tanzhen = ttk.Button(mainframe, text='选择', command='')
btn_tanzhen.grid(row=2, column=2)
# 用户班表标签框
ttk.Label(mainframe, text="用户班表").grid(row=3, column=0, sticky=W)
# 用户班输入框
self.entry_yonghuban = StringVar()
entry_yonghuban = ttk.Entry(
mainframe, textvariable=self.entry_yonghuban)
entry_yonghuban.grid(row=3, column=1, sticky=(W, E), padx=10, pady=10)
# 响应式布局
mainframe.columnconfigure(1, weight=1)
# 用户班选择按钮
btn_tanzhen = ttk.Button(mainframe, text='选择', command='')
btn_tanzhen.grid(row=3, column=2)
# 分隔线
ttk.Separator(root, orient=HORIZONTAL).grid(
row=4, sticky='W,E', padx=50)
# 处理数据标签
label_work_with_data = ttk.Label(mainframe, text="处理数据")
label_work_with_data.grid(row=5, column=0, sticky=W, pady=10)
label_work_with_data.config(font=("宋体", 12, "bold"))
# 处理数据操作标签
ttk.Label(mainframe, text="处理数据").grid(row=6, column=0, sticky=W)
# 处理数据按钮
btn_work_with_data = ttk.Button(mainframe, text='开始处理数据', command='')
btn_work_with_data.grid(row=6, column=2)
# 分隔线
ttk.Separator(root, orient=HORIZONTAL).grid(
row=7, sticky='W,E', padx=50)
# 处理结果标签
label_work_with_data = ttk.Label(mainframe, text="处理结果")
label_work_with_data.grid(row=8, column=0, sticky=W, pady=10)
label_work_with_data.config(font=("宋体", 12, "bold"))
root = Tk()
tanZhen(root)
root.mainloop()