0
如何將CSV導入到列表框?我想CSV數據進入下面的列表框,而不是文本,是否有一個Python文件命令,可以讓我做到這一點?使用Tkinter將CSV導入到Python列表框
class RequestGUI():
lblStatus = Label(root, text = 'Status')
lblStatus.place(x =6, y =5)
lblFacName = Label(root, text = 'Facility Name')
lblFacName.place(x =150, y =5)
lblDWGTitle = Label(root, text = 'Title')
lblDWGTitle.place(x =525, y =5)
colStatus = Listbox(root, height = 12, width =6)
colStatus.place(x = 6, y = 32)
colStatus.insert(END, " IN")
colFacName = Listbox(root, height = 12, width =45)
colFacName.place(x = 56, y = 32)
colFacName.insert(END, " NW WASHINGTON")
colDWGTitle = Listbox(root, height = 12, width =72)
colDWGTitle.place(x = 340, y = 32)
colDWGTitle.insert(END, " CAPACITOR VOLTAGE")
您必須閱讀csv並將每列插入到列表框中。您可以編寫自己的函數,將行作爲元組,並將每個值添加到每個列表框 –