如何正确使用文件资源管理器浏览功能-PySimpleGUI [英] How to correctly use File Explorer browse function - PySimpleGUI
问题描述
我正在尝试在PySimpleGUI中使用浏览功能.我使用了 PySimpleGUI文件浏览器特定的文件类型来查找如何浏览.但是,我想从两种文件类型中进行选择,并且需要选择多个文件才能使其工作.我的问题:
I am trying to use the browse function in PySimpleGUI. I have used PySimpleGUI file browser specific file type to find out how to browse. However there are two file types that I want to choose from and multiple files need to be selected for this to work. My question:
如何使用浏览功能浏览两种类型的文件?,还如何允许浏览多个文件?,最后如何做您将每个文件分开吗?
我知道有一个key
函数用于获取数据,但是我如何才能对一个以上的文件进行处理.
I know that there is a key
function for getting data but how can I do that for more than one file.
如果您有点困惑:
用户必须选择浏览功能,并且必须能够在选择多个文件的同时从.txt和.Docx文件中进行选择.该程序必须能够分辨出文件之间的差异,以便可以在每个文件上分别运行一个功能.
到目前为止,我的代码:
My code so far:
import PySimpleGUI as sg
sg.theme('DarkAmber') # Add a touch of color
# All the stuff inside your window.
layout = [ [sg.FileBrowse(file_types=(("Text Files", "*.txt"),))],
[sg.Button('Lets GO!!!')]
]
# Create the Window
window = sg.Window('Test', layout).Finalize()
window.Maximize()
有人可以完成此代码吗?
Can someone finish this code?
推荐答案
根据文档:
file_types=(("Text Files", "*.txt"),("CSV Files", "*.csv"),)
有效.
这篇关于如何正确使用文件资源管理器浏览功能-PySimpleGUI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!