我正在尝试使用tkinter用选定的csv文件头创建一个下拉列表
def clickpath():
# window.filePath = filedialog.askopenfilename(initialdir = "/",title = "Select file",filetypes = (("all files","*.*")))
filename = filedialog.askopenfilename()
pathin.delete(0,END)
pathin.insert(0,filename)
我想创建一个选项菜单,以将pathin.get()用作列表。 但是我无法使其工作 有人可以帮忙吗? 非常感谢!
我有这样的东西..但不确定如何正确调用...
var = StringVar(window)
var2 = StringVar(window)
option = OptionMenu(window,var2,"test")
option.grid(column=4,row=11)
option.pack()
var.set("column")
file = pathin.get()
def test():
global var
column =var.get()
with open(colum,"rt") as f:
var2 = read.csv.DictReader(f)
return var2