diff --git a/wxPython/wx/lib/filebrowsebutton.py b/wxPython/wx/lib/filebrowsebutton.py index 9d7d29b567..0a492fd7fc 100644 --- a/wxPython/wx/lib/filebrowsebutton.py +++ b/wxPython/wx/lib/filebrowsebutton.py @@ -346,18 +346,27 @@ class DirBrowseButton(FileBrowseButton): dialogTitle = '', startDirectory = '.', changeCallback = None, - dialogClass = wx.DirDialog): + dialogClass = wx.DirDialog, + newDirectory = False): FileBrowseButton.__init__(self, parent, id, pos, size, style, labelText, buttonText, toolTip, dialogTitle, startDirectory, changeCallback = changeCallback) self.dialogClass = dialogClass + self.newDirectory = newDirectory # def OnBrowse(self, ev = None): + style=0 + + if self.newDirectory: + style|=wx.DD_NEW_DIR_BUTTON + dialog = self.dialogClass(self, message = self.dialogTitle, - defaultPath = self.startDirectory) + defaultPath = self.startDirectory, + style = style) + if dialog.ShowModal() == wx.ID_OK: self.SetValue(dialog.GetPath()) dialog.Destroy()