tkinter file pattern set in a file dialog

后端 未结 3 1056
别那么骄傲
别那么骄傲 2021-01-18 04:25

To get the set of expected files with given extensions in a file dialog, I\'ve seen in several places written patterns as (\'label\',\'pattern\'), the pattern b

3条回答
  •  一整个雨季
    2021-01-18 04:50

    import tkinter
    options = {}
    options['defaultextension'] = '.txt'
    options['filetypes'] = [('all files', '.*'), ('text files', '.txt'),('asc files', '.asc')]
    options['initialdir'] = '.'
    file_open = tkinter.filedialog.askopenfile(mode='r', **options)
    

提交回复
热议问题