python TK怎么做一个浏览按钮获取文件全路径,下边的代码只能获取到最后一层文件夹,不能获取文件名

具体代码如下,求大神帮忙:
class ArtCheck(object):
def _init_(self):
self._top=Tk()
self._f_dir=Fram(self._top,width=100)
self._cwd=StringVar(self._top)
Entry(self._f_dir,width=100,textvarible=self._cwd)
Button(self._f_dir,command=self.findDir)
def findDir(self):
root=Tk()
root.withdraw()
dirname=tkFileDialog.askdirectory(parent=root,initialdir='/',title=('选择路径'))
self.cwd.set(dirname)
if _name_=='_main':
artobject=ArtCheck()
mainloop()

因为你函数用错了啊
tkFileDialog.askdirectory是用来获取目录的
tkFileDialog.askopenfilename是用来获取文件全路径的
tkFileDialog.askopenfilenames是用来获取多个文件的路径的
温馨提示:答案为网友推荐,仅供参考