我正在尝试将目录路径获取到Te 的入口字段中
Gui文件
self.btn_browseOne = tk.Button(self.master,width=13, height=2, text='Browse...', command=lambda:func.getDir())
func文件
def getDir():
getPath = filedialog.askdirectory()
txt_browseEntryOn.insert(0,getPath)
return getPath
if __name__=="__main__":
pass
from tkinter import *
from tkinter import ttk, filedialog as fd
root = Tk()
entry1 = ttk.Entry(root)
entry1.pack()
def getDirPath():
z = fd.askdirectory()
entry1.insert(END,z)
b1 = ttk.Button(root,text="ok",command=getDirPath)
b1.pack()
root.mainloop()