import tkinter as tk
from tkinter import ttk
def cbBegin(self):
pass
def sel_result():
pass
def get_result():
pass
def get_data(filename):
pass
mb_col = ['A','B','C','D','E','F','G','H','I','J','K']
xx_col = ['A','B','C','D','E']
root = tk.Tk() # 创建一个窗口
root.title('AAAA') # 窗口标题
root.geometry("430x300+370+150")
srb = ttk.Scrollbar(root)
frm = tk.Text(root, height='8', width='20')
global listC
listC = []
tk.Label(root, text='AAAAAAAA', height=1, width=20,\
padx=0,pady=10,background='green', foreground='white').grid(row=0,column=0)
tk.Label(root, text='DDDDDDDD', height=1, width=20,\
padx=0,pady=10,background='green', foreground='white').grid(row=0,column=1)
for i, m in enumerate(mb_col):
lab = ttk.Label(frm, text=m, width=20)
frm.window_create(tk.INSERT,window=lab)
lab.grid(row=i + 1,column=0, padx=5, pady=5, columnspan=2)
cv = tk.StringVar()
cmb = bobox(frm, values= xx_col, textvariable=cv, width=30)
frm.window_create(tk.INSERT,window=cmb)
listC.append(cmb)
cmb.grid(row=i + 1, column=4, padx=5, pady=5, columnspan=3)
cmb.bind('', cbBegin) # 得到焦点时执行
srb.config(command=frm.yview)
frm.config(yscrollcommand=srb.set)
srb.grid(row=1, column=2, rowspan=i, sticky=tk.S + tk.N)
frm.grid(row=1,column=0,columnspan=2, sticky=tk.S + tk.N)
tk.Button(root, text="确定", command=get_result, height=1, width=7, \
padx=10, pady=1, bg='orange').grid(row=i+1,column=0,padx=5, pady=5)
tk.Button(root, text="退出", command=root.quit, height=1, width=7, \
padx=10, pady=1, bg='orange').grid(row=i+1,column=1, padx=5, pady=5)
root.mainloop()