【发布时间】:2019-10-17 18:21:49
【问题描述】:
基于我的图像“我的元组列表”和图像“Tkinter 树视图”,由于某种原因,它不会在一列中显示公司名称,在第二列中显示值。我无法弄清楚错误。任何帮助表示赞赏
import Tkinter as tk
import ttk
from function4 import *
root = tk.Tk()
treeView = ttk.Treeview(root)
# set up the columns and headings
# In reality "Member ID" would be exported from the database
treeView["columns"] = ["CompanyName", "AwardedAmount"]
treeView["show"] = "headings"
treeView.heading("CompanyName", text="Company Name")
treeView.heading("AwardedAmount", text="Awarded Amount")
treeView.grid(columnspan=2)
# Add content using (where index is the position/row of the treeview)
# iid is the item index (used to access a specific element in the treeview)
# you can set iid to be equal to the index
tuples = reg_company_award(supplierNameList, companyNameList, awardList)
index = iid = 0
for values in tuples:
print values
treeView.insert("", 'end', values=values)
index = iid = index + 1
root.mainloop()
基于图像“我的元组列表”,树视图上的预期输出应在一列上显示公司名称,在另一列上显示值。但是当前的树视图如图“tkinter treeview”所示
【问题讨论】:
-
Edit 你的问题并显示 ONE
print values的输出。拜托,没有图像!