[Python] Add multiple extensions in one filetypes mac - tkinter/filedialog/askopenfilename

Discussão em 'Python' iniciado por Stack, Agosto 11, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to use tkinter.filedialog to choose the file in Mac.

    It works fine with one filetype in this way:

    filedialog.askopenfilename(filetypes=[("Excel files", "*.xlsx")])


    However, I want to choose either xlsx or xls files. I searched and found a question filedialog, tkinter and opening files. I use the similar way but it does not work with Mac if I change to this:

    filedialog.askopenfilename(filetypes=[("Excel files", "*.xlsx; *.xls")])


    How should I change to choose either xlsx or xls files in the file dialog?

    Continue reading...

Compartilhe esta Página