The documentation defines file_types parameter as Tuple[Tuple[str,str]] Does it mean that only one tuple possible? And only one filetype?
It does not work for me with two tuples and two extensions and one tuple and a string of extensions.
sg.FilesBrowse("COMEDY", file_types= (("mkv","*.mkv"),("avi","*.avi")),initial_folder=comedy_PATH)
sg.FilesBrowse("COMEDY", file_types= (("video files","*.mkv *.avi")),initial_folder=comedy_PATH)
sg.FilesBrowse("COMEDY", file_types= (("video files",".mkv .avi")),initial_folder=comedy_PATH)
I don't get errors I get the empty list. With just one extension, it works, as tuple inside a tuple.
any suggestions?
CodePudding user response:
A comma missed in your file types, it will be Tuple[str, str]
, not Tuple[Tuple[str, str]]
import PySimpleGUI as sg
type_1 = (
("All JPG Files","*.jpg"),
("All PNG Files","*.png"),
)
type_2 = (
("All Picture Files", "*.jpg *.png"), # A comma missed in your code
)
type_3 = (
("All Picture Files", ".jpg .png"), # A comma missed in your code
)
layout = [
[sg.Input(), sg.FilesBrowse(file_types=type_1)],
[sg.Input(), sg.FilesBrowse(file_types=type_2)],
[sg.Input(), sg.FilesBrowse(file_types=type_3)],
]
sg.Window('Title', layout).read(close=True)