victorsc
victorsc

Reputation: 722

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

Using this example from sampleTextEditor, while browsing I can see and I can open any file ( . ) with an extension. How can I open a file without an extension ?

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

Upvotes: 0

Views: 523

Answers (1)

EaterOfCode
EaterOfCode

Reputation: 2222

change *.* to *

so now the whole filename is under the wild card and there is no dot needed

Upvotes: 2

Related Questions