如何正确使用文件资源管理器的浏览功能 - PySimpleGUI

How to correctly use File Explorer browse function - PySimpleGUI

我正在尝试使用 PySimpleGUI 中的浏览功能。我已经使用 PySimpleGUI file browser specific file type 了解如何浏览。但是,我想从两种文件类型中进行选择,并且需要 select 编辑多个文件才能使其正常工作。我的问题:

如何使用浏览功能来浏览两种类型的文件?还有如何允许浏览多个文件? 最后 如何区分每个文件?

我知道有一个 key 函数可用于获取数据,但我如何为多个文件执行此操作。

如果你有点困惑:

用户必须 select 浏览功能并且必须能够在 select 浏览多个文件时从 .txt 和 .Docx 文件中进行选择。该程序必须能够区分文件之间的差异,因此函数可以分别在每个文件上 运行。

到目前为止我的代码:

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()

有人能完成这段代码吗?

根据文档:

file_types=(("Text Files", "*.txt"),("CSV Files", "*.csv"),)

有效。