treectrl MultiListbox网格/填充方法

时间:2020-10-16 19:43:42

标签: python tkinter listbox

我似乎无法找到一种方法来显示“单元格”之间的网格/边界,我已经按照下面的示例链接并想添加某种形式的列和行分隔

Display Listbox with columns using Tkinter?

到目前为止,这是我的代码

List_box = []
Tab_List = []
LB = 0
c.execute('SELECT DISTINCT Table_No FROM Tables')
for row1 in c.fetchall():
    Tab_List.append(ttk.Frame(tabControl2))
    tabControl2.add(Tab_List[LB], text=("Table: " + str(row1[0])))
    List_box.append(treectrl.MultiListbox(Tab_List[LB], width=tabControl2_width, height=tabControl2_height, font=Font(family="Times New Roman", size=15)))
    List_box[LB].pack(fill='both')
    List_box[LB].config(columns=('PLU', 'Name', 'QTY', 'Price', 'Total Price'))
    c.execute('SELECT * FROM Tables WHERE Table_No=?',((row1[0]),))
    for row in c.fetchall():
        print(row)
        Name = (row[1])
        QTY = (row[3])
        PLU = (row[0])
        Price = (row[2])
        Total_Price = (row[4])
        Item = (PLU, Name, QTY, Price, Total_Price)
        List_box[LB].insert('end',*map(Row_func,Item))
        LB += 1

这是创建列表框的一部分

treectrl.MultiListbox(Tab_List[LB], width=tabControl2_width, height=tabControl2_height, font=Font(family="Times New Roman", size=15)))

0 个答案:

没有答案