用askopenfilename删除末尾的选项(open,close)

2024-09-29 23:15:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我用askopenfilename打开了这个目录。 但是,我不想打开该文件,我需要它,只是为了查看该特定路径中存在的文件。 我想在单击框架中的按钮后查看路径文件夹内容。 不仅要看到路径中的内容,还要来回移动。 所以我想删除最后的选项(Datename,open,close)

不管怎样我都能解决这个问题

这是我用过的代码: f1=框架(根) 对于帧输入(f1): frame.grid(行=0,列=0)

frame1 = ttk.LabelFrame(f1, text="Data")
frame1.grid(row=1, column=5, padx=(30,10), pady=(10,0), columnspan=2)  
b01 = ttk.Button(frame1, text="New", compound = "left", width=12, command=Dir_Data)
b01.grid(row=4, column=5, padx=20, pady=5, ipadx=5, ipady=5)                                                                

def Dir_Data():                                                                                             
    directory = "C:\Req_file\date_files"                                                                 
    temp = filedialog.askopenfile(initialdir=directory)

Tags: 文件text路径框架内容datacolumngrid

热门问题