This class represents the directory chooser dialog.
This class supports the following styles:
wx.DD_DEFAULT_STYLE
: Equivalent to a combination of wx.DEFAULT_DIALOG_STYLE
and wx.RESIZE_BORDER
(the last one is not used under WinCE).wx.DD_DIR_MUST_EXIST
: The dialog will allow the user to choose only an existing folder. When this style is not given, a “Create new directory” button is added to the dialog (on Windows) or some other way is provided to the user to type the name of a new folder.wx.DD_CHANGE_DIR
: Change the current working directory to the directory chosen by the user.RESIZE_BORDER
has special side effect under recent (i.e. later than Win9x) Windows where two different directory selection dialogs are available and this style also implicitly selects the new version as the old one always has fixed size. As the new version is almost always preferable, it is recommended that RESIZE_BORDER
style be always used. This is the case if the dialog is created with the default style value but if you need to use any additional styles you should still specify DD_DEFAULT_STYLE
unless you explicitly need to use the old dialog version under Windows. E.g. do
dlg = wx.DirDialog (None, "Choose input directory", "",
wx.DD_DEFAULT_STYLE | wx.DD_DIR_MUST_EXIST)
instead of just using DD_DIR_MUST_EXIST
style alone.
See also
__init__ |
Constructor. |
GetMessage |
Returns the message that will be displayed on the dialog. |
GetPath |
Returns the default or user-selected path. |
SetMessage |
Sets the message that will be displayed on the dialog. |
SetPath |
Sets the default path. |
ShowModal |
Shows the dialog, returning wx.ID_OK if the user pressed wx.OK , and wx.ID_CANCEL otherwise. |
wx.
DirDialog
(Dialog)¶Possible constructors:
DirDialog(parent, message=DirSelectorPromptStr, defaultPath="",
style=DD_DEFAULT_STYLE, pos=DefaultPosition, size=DefaultSize,
name=DirDialogNameStr)
This class represents the directory chooser dialog.
__init__
(self, parent, message=DirSelectorPromptStr, defaultPath="", style=DD_DEFAULT_STYLE, pos=DefaultPosition, size=DefaultSize, name=DirDialogNameStr)¶Constructor.
Use ShowModal
to show the dialog.
Parameters: |
|
---|
GetMessage
(self)¶Returns the message that will be displayed on the dialog.
Return type: | string |
---|
GetPath
(self)¶Returns the default or user-selected path.
Return type: | string |
---|
SetMessage
(self, message)¶Sets the message that will be displayed on the dialog.
Parameters: | message (string) – |
---|
SetPath
(self, path)¶Sets the default path.
Parameters: | path (string) – |
---|
ShowModal
(self)¶Shows the dialog, returning wx.ID_OK
if the user pressed wx.OK
, and wx.ID_CANCEL
otherwise.
Return type: | int |
---|
Message
¶See GetMessage
and SetMessage