How to correctly use File Explorer browse function - PySimpleGUI

拥有回忆 提交于 2020-04-18 03:57:48

问题


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:

How do you use the browse function for browsing two types of files? and also How do you allow multiple files to be browsed? and finally How do you tell each file apart?

I know that there is a key function for getting data but how can I do that for more than one file.

In case you are a tiny bit confused:

The user must select the browse function and must be able to choose from .txt and .Docx files while selecting more than one file. The program must be able to tell the difference between the files so a function can be run on each file separately.

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?

来源:https://stackoverflow.com/questions/61275177/how-to-correctly-use-file-explorer-browse-function-pysimplegui

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!