PySimpleGUI > file_types() not working on macOS

file_types() is not available on macOS.

While browsing it should only show PNG files.

Does anyone know an alternative way to browse through multiple PNG files?

Line 9

# /usr/bin/python3
# -*- coding: utf-8 -*-

import PySimpleGUI as sg

def main():

    layout = [
             [sg.FilesBrowse(button_text='Galaxie(n) hochladen', file_types=('.png'), key='_FILES_')],
             [sg.OK(),
              sg.Cancel()]
             ]

    window = sg.Window('Vorverarbeitung', layout, background_color='#1e1e1e')

    while True:
        event, values = window.read()
        print(values['_FILES_'].split(';'))
        if event in (None, 'Exit'):
            break
    window.close()

Answer

In the main PySimpleGUI documentation, if you search for file_types you’ll find this:

enter image description here

[ EDIT ] One of the reasons the PySimpleGUI project recommends opening issues on the GitHub rather than posting here is that the Issue form contains this checklist, meant to save you considerable amounts of time. Even if you don’t want to post an Issue, the next time you’ve got a question/program, take a look at the GitHub issues checklist. It may save you and others a lot of time.

  • [ ] Searched main docs for your problem www.PySimpleGUI.org
  • [ ] Looked for Demo Programs that are similar to your goal Demos.PySimpleGUI.org
  • [ ] If not tkinter – looked for Demo Programs for specific port
  • [ ] For non tkinter – Looked at readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
  • [ ] Run your program outside of your debugger (from a command line)
  • [ ] Searched through Issues (open and closed) to see if already reported Issues.PySimpleGUI.org
  • [ ] Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released