簡體   English   中英

如何在wxPython的打開文件對話框中選擇沒有任何擴展名的文件?

[英]How to choose a file without any extension in an open file dialog in wxPython?

使用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

改變*.**

所以現在整個文件名都在外卡下,不需要點

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM