如何在wxPython的打开文件对话框中选择没有任何扩展名的文件?

时间:2012-08-06 12:34:30

标签: python wxpython openfiledialog

在sampleTextEditor中使用此示例,在浏览时我可以看到,我可以打开任何带扩展名的文件()。如何在没有扩展名的情况下打开文件?

def defaultFileDialogOptions(self):
    ''' Return a dictionary with file dialog options that can be
        used in both the save file dialog as well as in the open
        file dialog. '''
    return dict(message='Choose a file', defaultDir=self.dirname,
                wildcard='*.*')

def askUserForFilename(self, **dialogOptions):
        dialog = wx.FileDialog(self, **dialogOptions)
        if dialog.ShowModal() == wx.ID_OK:
            userProvidedFilename = True
            self.filename = dialog.GetFilename()
            self.dirname = dialog.GetDirectory()
            self.SetTitle() # Update the window title with the new filename
        else:
            userProvidedFilename = False
        dialog.Destroy()
        return userProvidedFilename

1 个答案:

答案 0 :(得分:2)

*.*更改为*

所以现在整个文件名都在外卡下,并且不需要点